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