in my app (android 4.0) i need to retrieve the address from a contact. I used the solution provided in another post here:
Uri contactData = data.getData();
Cursor c = managedQuery(contactData, null, null, null, null);
if (c.moveToFirst()) {
String city = c.getString(c.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.CITY));}
But when i try to execute this, i get an error:
“Failed to read row 0, column -1 from a CursorWindow which has 1 rows, 29 columns.
“
What am i doing wrong here? Why doesn’t he find the city column?
Ok, solved it, got some stupid mistakes…
Here is the working code:
manifest.xml:
Code: