0

After spending a few weeks on an App for my company all my questions were answered here. But now i have something very strange which i have nothing found for so I hope somebody can help me.

I try to read Android Contacts. Actually everything is working fine except the company name. I am not able to read it. On the other hand writing the company name is no problem.

When I try to read / get the company name it will display the full name of the contact on my mobile device and the phone number on the emulator.

Here is the code where i read the company name:

Cursor comCur = managedQuery ( 
                    ContactsContract.Data.CONTENT_URI, 
                    null,
                    ContactsContract.CommonDataKinds.Organization.CONTACT_ID + " = ?", 
                    new String[]{id}, null); 
comCur.moveToFirst();
String company = comCur.getString(comCur.getColumnIndex(ContactsContract.CommonDataKinds.Organization.COMPANY));    

When I debug the app, the variable company has the full name or the phone number but never the company name.

I have the same code for other fields like mail-address, the only difference is that it has

ContactsContract.CommonDataKinds.Email.CONTENT_URI    

instead of

ContactsContract.Data.CONTENT_URI

But if i understand it the right way my code is not wrong...or is it?

I am sure you guys can help me...PLEASE

Joe Doyle
  • 6,363
  • 3
  • 42
  • 45
alipf
  • 35
  • 1
  • 5

1 Answers1

0

hi you can refer to the following link for the answer. How to read contacts on Android 2.0. i checked it out and it's working

Community
  • 1
  • 1
Jack
  • 373
  • 1
  • 6
  • 14