[solved]Accessing the Contacts

Put your problem here if it does not fit any of the other categories.

[solved]Accessing the Contacts

Postby shiteiru » Tue Jun 03, 2008 10:59 am

as the topic says, i want to acces the Contacts...in this case of the AndroidEmulator.
Right know the only thing i am able to do ist query the contacts and get the name of the found contact(s). I can't access all the other fields.

In the official AndroidDocumentation i found the following:
ContentProviders
People.Phones

the thing is that im trying to access a custom made ContactLabel. (in the contactslist of the emulator you can add some customfields to a contact like: notes, further street information aso.)

the following code works just fine:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Cursor cur = managedQuery(
  2.                 android.provider.Contacts.People.CONTENT_URI,
  3.                 null,
  4.                 null,  
  5.                 null);
  6.        
  7. startManagingCursor(cur);
  8. int notesColumn = cur.getColumnIndex(android.provider.Contacts.People.NAME );
  9.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


however...if i try to acces another column of the found Contact i get a NullPointerException.

Question is...how cann i access the other fields of the found contact????

I tried some options but do still get the same, or some other errors.
shiteiru
Junior Developer
Junior Developer
 
Posts: 23
Joined: Tue May 20, 2008 7:16 pm

Top

Postby shiteiru » Sat Jun 07, 2008 11:38 am

Tip: its easier to program your own custom made contactslist than to acces the "android default given one"....
shiteiru
Junior Developer
Junior Developer
 
Posts: 23
Joined: Tue May 20, 2008 7:16 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 15 guests