Issue while access contacts of android

Posted by Rishabh on Stack Overflow See other posts from Stack Overflow or by Rishabh
Published on 2009-09-23T05:10:29Z Indexed on 2011/01/03 7:53 UTC
Read the original article Hit count: 312

Filed under:
|

I am new for android development. I am trying read and write contacts to android addressbook.

I tried following line of code for write name into android

public class SecondApp extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); 
setContentView(R.layout.main); 

ContentValues values = new ContentValues();
values.put(Contacts.People.NAME, "Rishabh");
ContentResolver cr = getContentResolver();
Uri uri = cr.insert(People.CONTENT_URI, values);

but i am getting "The application has stopped unexpectedly. Please try again" message.

what is wrong in it ? How can i access contacts of android ?

© Stack Overflow or respective owner

Related posts about java

Related posts about android