I was writing a program to retrieve all the contacts from the Phonebook.
Here goes my code inside onCreate:
setContentView(R.layout.cursorlayout);
ListView lv =(ListView)findViewById(R.id.cursorListView);
String uriString = "content://contacts/people/";
//Cursor myCursor = managedQuery(Uri.parse(uriString),null, null,null,null);
Cursor myCursor = getContentResolver().query(People.CONTENT_URI, new String[] {People._ID, People.NAME, People.NUMBER}, null, null, null);
startManagingCursor(myCursor);
String from[] = new String[]{"People.NAME","People.NUMBER"};
int to[] = new int[]{R.id.name,R.id.number};
SimpleCursorAdapter s = new SimpleCursorAdapter(this,R.layout.simplecursorlayout,myCursor,from,to);
lv.setAdapter(s);
However, eclipse marked the class “People” as deprecated.Infact the parent container “Contacts” itself is deprecated. So my question is, Is there any alternative to this class that I can use ?
Its ContactsContract!