Have you setup the security permissions needed to read contacts info
in AndroidManifest.xml?
-Dave
On Jul 10, 7:44 am, andyn <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I want to include a listview displaying my contacts' names.
> I have the following code:
>
> ------------------
> String[] projection = new String[] {
> android.provider.BaseColumns._ID,
> android.provider.Contacts.PeopleColumns.NAME,
> android.provider.Contacts.PhonesColumns.NUMBER
> };
>
> int [] tempInt= new int[]{R.id.nameList};
>
> Cursor managedCursor =
> this.managedQuery(android.provider.Contacts.Phones.CONTENT_URI,
> projection, null, android.provider.Contacts.PeopleColumns.NAME + "
> ASC");
>
> ListView contactsList = (ListView)findViewById(R.id.nameList);
>
> SimpleCursorAdapter contactsAdapter= new
> SimpleCursorAdapter(this ,android.R.layout.simple_list_item_1,
> managedCursor, projection, tempInt );
> contactsList.setAdapter(contactsAdapter);
>
> -----------------
>
> When running the application I also get a list with the correct number
> of rows. But there's no content included. So the rows are just
> empty...
>
> Does anybody see my fault?
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---