Use something like this.modify this code according to your requirement.
*
public* *void* onCreate(Bundle icicle) {
*super*.onCreate(icicle);
Cursor c = getContentResolver().query(People.*CONTENT_URI*, *null*, *null*,
*null*, *null*);
startManagingCursor(c);
String[] columns = *new* String[]{People.*NAME*}; // Comment
*int*[] names = *new* *int*[]{R.id.*row_entry*};
mAdapter = *new* SimpleCursorAdapter(*this*, R.layout.*main*, c, columns,
names);
*this*.setListAdapter(mAdapter);
}
@Override
*protected* *void* onListItemClick(ListView l, View v, *int* position, *long
* id){
*super*.onListItemClick(l, v, position, id);
Intent i = *new* Intent();
Cursor c = (Cursor) mAdapter.getItem(position);
*long* phoneID = c.getLong(c.getColumnIndex(People.*PRIMARY_PHONE_ID*));
i.setData(ContentUris.*withAppendedId*(
android.provider.Contacts.Phones.*CONTENT_URI*, phoneID));
*this*.startActivity(i);
On Wed, Mar 4, 2009 at 10:12 AM, cool.manish <[email protected]> wrote:
>
> Hi, I am creating an application which will display all contacts from
> the phone book. Is there any API which can access the phone book.
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---