Get the address from the contacts.
- by KKC
can someone help me with the following code to get the address stored from the contact??
THANK YOU!
// Extract the address.
String where = ContactsContract.ContactMethods.PERSON_ID + " == " + id +
" AND " +
ContactsContract.ContactMethods.KIND + " == " + ContactsContract.KIND_POSTAL;
addressCursor = context.getContentResolver().query(ContactsContract.ContactMethods.CONTENT_URI, null, where, null, null);
// Extract the postal address from the cursor
int postalAddress = addressCursor.getColumnIndexOrThrow(ContactsContract.ContactMethodsColumns.DATA);
String address = "";
if (addressCursor.moveToFirst())
address = addressCursor.getString(postalAddress);
addressCursor.close();