Get the address from the contacts.

Posted by KKC on Stack Overflow See other posts from Stack Overflow or by KKC
Published on 2010-04-19T07:29:30Z Indexed on 2010/04/19 7:33 UTC
Read the original article Hit count: 345

Filed under:
|

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();

© Stack Overflow or respective owner

Related posts about address

Related posts about android