My code is: activity.setContentView(R.layout.contacts); //activity.setContentView(R.id.contactsList);
String[] projection = new String[] { android.provider.BaseColumns._ID, android.provider.Contacts.PeopleColumns.NAME //android.provider.Contacts.PhonesColumns.NUMBER, //android.provider.Contacts.PeopleColumns.PHOTO }; int [] tempInt= new int[]{R.id.contactsList}; // Best way to retrieve a query; returns a managed query. Cursor managedCursor = activity.managedQuery(android.provider.Contacts.Phones.CONTENT_URI, projection, null, android.provider.Contacts.PeopleColumns.NAME+ "ASC"); // Order-by clause. ListView contactsList= (ListView)activity.findViewById(R.id.contactsList); SimpleCursorAdapter contactsAdapter= new SimpleCursorAdapter(activity, android.R.layout.simple_list_item_1,managedCursor, projection, tempInt ); contactsList.setAdapter(contactsAdapter); I get a null pointer exception I think the contactsAdapter is null. I have included the READ_CONTACTS permission in the androidManifest.xml I have 2 contacts right now on the android emulator. Sylvester --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com 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-beginners?hl=en -~----------~----~----~----~------~----~------~--~---