Fetching only the Mobile Number from Android contacts - java

how would I modify the following code so that it grabs the name(which it already does) and the mobile number from Android contacts? I would like the phone number labeled as mobile in contacts.
private ArrayList<ContactInfo> getLegalContacts() {
ArrayList<ContactInfo> legalContacts = new ArrayList<>();
List<String> contacts = loadLegalContacts();
Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " ASC");
while (phones.moveToNext()) {
String id = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.CONTACT_ID));
String name = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
String phoneNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
if (phoneNumber != null) {
phoneNumber = phoneNumber.replace("(", "");
phoneNumber = phoneNumber.replace(")", "");
phoneNumber = phoneNumber.replace("-", "");
phoneNumber = phoneNumber.replace(" ", "");
phoneNumber = phoneNumber.replace("+", "");
}
if (contacts.contains(id)) {
ContactInfo info = new ContactInfo(id, name, phoneNumber, true);
boolean isNew = true;
for (int i = 0; i < legalContacts.size(); i++) {
if (TextUtils.equals(legalContacts.get(i).name, name)) {
isNew = false;
break;
}
}
if (isNew) {
legalContacts.add(info);
}
}
}
phones.close();
return legalContacts;
}
private List<String> loadLegalContacts() {
List<String> contacts = new ArrayList<>();
Set<String> set = SharedPrefUtil.getInstance().getStringSet("LegalContacts");
if (set != null) {
contacts.addAll(set);
}
return contacts;
}

You can do it like this
private ArrayList<ContactInfo> getLegalContacts() {
ArrayList<ContactInfo> legalContacts = new ArrayList<>();
List<String> contacts = loadLegalContacts();
Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " ASC");
while (phones.moveToNext()) {
String id = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.CONTACT_ID));
String name = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
String phoneNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
String labelString = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE));
if(labelString!=null)
{
int type = Integer.parseInt(labelString);
if(type==ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE) {
Log.d("LableTag", " lable is : " + type);
if (phoneNumber != null) {
phoneNumber = phoneNumber.replace("(", "");
phoneNumber = phoneNumber.replace(")", "");
phoneNumber = phoneNumber.replace("-", "");
phoneNumber = phoneNumber.replace(" ", "");
phoneNumber = phoneNumber.replace("+", "");
}
if (contacts.contains(id)) {
ContactInfo info = new ContactInfo(id, name, phoneNumber, true);
boolean isNew = true;
for (int i = 0; i < legalContacts.size(); i++) {
if (TextUtils.equals(legalContacts.get(i).getName(), name)) {
isNew = false;
break;
}
}
if (isNew) {
legalContacts.add(info);
}
}
}
}
}
phones.close();
return legalContacts;
}
labelString will hold the value of currently it is labeled as
Then we need to check whether it is a mobile type if true then we access it and add it to list
For more info visit ContactsContract.CommonDataKinds.Phone

Related

SQL Error: 1364, SQLState: HY000 - Field 'AccCode' doesn't have a default value

I am able to update table while running this , but not able to save. I am getting the below error.
SQL Error: 1364, SQLState: HY000 - Field 'AccCode' doesn't have a
default value org.hibernate.HibernateException:
org.hibernate.exception.GenericJDBCException: could not insert:
[com.anm.more.dao.AccMast].
public class AccmastAutoUpdate {
/*
* Created class for auto update of accmast table from .csv file through ftp
*/
enter code here
private static final Logger logger = Logger.getLogger(AccmastAutoUpdate.class);
static MailTicket mail = new MailTicket();
static StringBuffer storeMsg = new StringBuffer();
static int totalcount = 0;
static int errorRecCount = 0;
static int successRecCount = 0;
public static void main(String args[]) {
MoreUtils moreUtils = new MoreUtils();
Properties ps = moreUtils.getPropertyLoad("com/anm/more/bundle/Messages.properties");
String folderLoc = moreUtils.getPropertyValueByLabel(ps, "task_ftp_download");
folderLoc = folderLoc.replace("\\", "/");
System.out.println("Entering AccmastAutoUpdate");
File folder = new File(folderLoc);
File[] listOfFiles = folder.listFiles();
for (int i = 0; i < listOfFiles.length; i++) {
String filename = listOfFiles[i].getName();
if (filename.startsWith("Accmast") && listOfFiles[i].getName().endsWith(".csv")) {
logger.info(filename);
boolean flag = insertToAccmast(folderLoc + "/" + filename);
if (flag) {
File file = new File(folderLoc + "/" + filename);
}
storeMsg.append(System.getProperty("line.separator"));
storeMsg.append("Total Records : " + totalcount + " Success Records : " + successRecCount + " Failed Records : " + errorRecCount);
}
}
}
private static boolean insertToAccmast(String fileloc) {
// TODO Auto-generated method stub
boolean flag = false;
String AccCode = null;
String Account = null;
String Site = null;
String Phone = null;
// String Disp_Deno = null;
String Address = null;
String AccType = null;
// String Shortage_Deno = null;
String Fax = null;
String AccTeam = null;
String Status = null;
String City = null;
String State = null;
String Territory = null;
String URL = null;
String Pincode = null; // int
String Country = null;
String Industry = null;
String conttype = null;
String SiteCode = null;
String acccode1 = null;
String SiteID = null;
String ContactName = null;
String ServiceArea = null;
String BillId = null;
String ResponseHours = null;
String ResolutionHours = null;
String comments = null;
String AccBranchCode = null;
String AccBranchName = null;
String ZonalCode = null;
String acc_createdby = null;
String NSBID = null;
String Bank = null;
String AccessibilityType; // double
String AccessibilityTimeFrom; // double
String AccessibilityTimeTo = null;
String HubLocation = null;
String SubLocation = null;
String GLNumber = null;
String NumberOfATM = null; // double
String acc_createddate = null; // Date
DateFormat getDate = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss aa");
try {
CsvReader csvReader = new CsvReader(fileloc, ',');
boolean firstline = true;
while (csvReader.readRecord()) {
if (firstline) {
firstline = false;
continue;
}
try {
totalcount++;
csvReader.get(0);
AccCode = csvReader.get(0);
Account = csvReader.get(1);
Site = csvReader.get(2);
Phone = csvReader.get(4);
Address = csvReader.get(5);
AccType = csvReader.get(6);
Fax = csvReader.get(7);
AccTeam = csvReader.get(8);
Status = csvReader.get(9);
City = csvReader.get(10);
State = csvReader.get(11);
Territory = csvReader.get(12);
URL = csvReader.get(13);
Pincode = csvReader.get(14);
Country = csvReader.get(15);
Industry = csvReader.get(16);
conttype = csvReader.get(17);
SiteCode = csvReader.get(18);
acccode1 = csvReader.get(19);
SiteID = csvReader.get(20);
ContactName = csvReader.get(21);
ServiceArea = csvReader.get(22);
BillId = csvReader.get(23);
ResponseHours = csvReader.get(24);
ResolutionHours = csvReader.get(25);
comments = csvReader.get(26);
AccBranchCode = csvReader.get(27);
AccBranchName = csvReader.get(28);
ZonalCode = csvReader.get(29);
acc_createdby = csvReader.get(30);
NSBID = csvReader.get(32);
Bank = csvReader.get(33);
AccessibilityType = csvReader.get(34);
AccessibilityTimeFrom = csvReader.get(35);
AccessibilityTimeTo = csvReader.get(36);
HubLocation = csvReader.get(37);
SubLocation = csvReader.get(38);
GLNumber = csvReader.get(39);
NumberOfATM = csvReader.get(40);
acc_createddate = csvReader.get(31);
AccMast accmast = new AccMast();
if (Pincode != null && Pincode != "" && Pincode.trim().length() <= 0) {
int PincodeNo = Integer.parseInt(Pincode);
accmast.setPincode(PincodeNo);
} else {
accmast.setPincode(123456);
}
if (NumberOfATM != null && NumberOfATM != "" && NumberOfATM.trim().length() <= 0) {
long NumberOfATMNo = Long.parseLong(NumberOfATM);
accmast.setNumberOfAtm(NumberOfATMNo);
} else {
accmast.setNumberOfAtm(0 L);
}
if (AccessibilityTimeFrom != null && AccessibilityTimeFrom != "" && AccessibilityTimeFrom.trim().length() <= 0) {
long AccessibilityTimeFromNo = Long.parseLong(AccessibilityTimeFrom);
accmast.setAccessibilityTimeFrom(AccessibilityTimeFromNo);
} else {
accmast.setAccessibilityTimeFrom(0 L);
}
if (AccessibilityTimeTo != null && AccessibilityTimeTo != "" && AccessibilityTimeTo.trim().length() <= 0) {
long AccessibilityTimeToNo = Long.parseLong(AccessibilityTimeTo);
accmast.setAccessibilityTimeTo(AccessibilityTimeToNo);
} else {
accmast.setAccessibilityTimeTo(0 L);
}
accmast.setAccCode(AccCode);
accmast.setAccount(Account);
accmast.setSite(Site);
accmast.setPhone(Phone);
accmast.setAddress(Address);
accmast.setAccType(AccType);
accmast.setFax(Fax);
accmast.setAccTeam(AccTeam);
accmast.setStatus(Status);
accmast.setCity(City);
accmast.setState(State);
accmast.setTerritory(Territory);
accmast.setUrl(URL);
accmast.setCountry(Country);
accmast.setIndustry(Industry);
accmast.setConttype(conttype);
accmast.setSiteCode(SiteCode);
accmast.setAcccode1(acccode1);
accmast.setSiteId(SiteID);
accmast.setContactName(ContactName);
accmast.setServiceArea(ServiceArea);
accmast.setBillId(BillId);
accmast.setResponseHours(ResponseHours);
accmast.setResolutionHours(ResolutionHours);
accmast.setComments(comments);
accmast.setAccBranchCode(AccBranchCode);
accmast.setAccBranchName(AccBranchName);
accmast.setZonalCode(ZonalCode);
accmast.setAccCreatedby(acc_createdby);
accmast.setNsbid(NSBID);
accmast.setBank(Bank);
//value has been sets accmast.setAccessibilityType(AccessibilityType);
accmast.setHubLocation(HubLocation);
accmast.setSubLocation(SubLocation);
accmast.setGlnumber(GLNumber);
//Date has been set accmast.setAccCreateddate(getDate.parse(acc_createddate));
AccMastDAO amd = new AccMastDAO();
//obj accmast able to view the content while debuggin.
//primary key is varchar in database.
boolean flag1 = amd.load(AccMast.class, AccCode);
if (flag1) {
amd.update(accmast);
} else {
amd.save(accmast);
}
successRecCount++;
System.out.println("Properties saved in accmast table object");
} catch (Exception ex) {
errorRecCount++;
storeMsg.append("AccMast : " + AccCode + "& Account : " + Account + " Failed");
storeMsg.append(System.getProperty("line.separator"));
ex.printStackTrace();
}
}
} catch (FileNotFoundException e) {
storeMsg.append(e.getMessage());
return false;
} catch (Exception e) {
errorRecCount++;
storeMsg.append(e.getMessage());
logger.info(e.getMessage());
return false;
}
return true;
}
}
//boolean method is working fine.
public boolean load(Class < ? > classType, Object id) {
Session session = super.getSession();
Object ob1 = (Object) session.get(classType, (Serializable) id);
if (ob1 != null) {
return true;
} else {
return false;
}
}
Based on your error code, check out this link:
Error: SQLSTATE[HY000]: General error: 1364 Field ‘xyz’ doesn’t have a default value
Otherwise, be sure that you're not updating a column constraint from NULL to NOT NULL if you don't provide a default value for already existing values to fill in.

How to show Only if phone Number is present using contactpicker

I am using Contact picker library for selecting multiple contacts but if a contact doesn't contain any number and if it is selected then it is showing some null pointer exception in the edit text field. How to remove that message and also how to remove trailing comma. Below is my Code.
try {
int pos = 0;
for (Contact contact : contacts) {
String displayName = contact.getDisplayName();
result.append(displayName + ",");
result.setSpan(new BulletSpan(15), pos, pos + displayName.length() + 1, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
//pos += displayName.length() + 1;
}
}
catch (Exception e) {
result.append(e.getMessage());
}
contactsView.setText(result);
please try to check this code
void getAllContacts() {
ArrayList<String> nameList = new ArrayList<>();
ArrayList<String> numberList = new ArrayList<>();
Uri uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI;
String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER;
String[] list = new String[]{ContactsContract.CommonDataKinds.Phone.NUMBER, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone._ID, ContactsContract.Contacts._ID};
Cursor cursor = getContentResolver().query(uri, list, selection, null, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " ASC");
cursor.moveToFirst();
if (cursor.moveToFirst()) {
do {
String contactNumber = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
String contactName = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
contactNuber.add(contactNumber);
contactsName.add(contactName);
nameList.add(contactName);
numberList.add(contactNumber);
} while (cursor.moveToNext());
cursor.close();
myContacts.put("name", nameList);
myContacts.put("number", numberList);
}
}

HashMap have the key though its containsKey method returns false?

Here is the log of my map entries. That have two same key exists. How this is possible?
Map<String, Objects> map = new HashMap<String, Objects>();
addContact("+917111111111");
addContact("+919222222222");
addContact("+919222222222");
private void addContact(String number){
if(TextUtils.isEmpty(number))return;
number = number.trim();
number = number.replaceAll("-", "");
number = number.replaceAll(" ", "");
if(!map.containsKey(number)) {
map.put(number, null);
}
}
/* While debugging in android studio. I have found the map have below entry.
0 = {HashMap$HashMapEntry#3798} "+919222222222" -> "null"
1 = {HashMap$HashMapEntry#3832} "‪+919222222222" -> "null"
2 = {HashMap$HashMapEntry#3694} "+917111111111" -> "null"
*/
map.containsKey("+919222222222");// ==> return false
Why this is happen ?
Actual task:
private void getContacts(){
try {
Cursor cursor = null;
StringBuffer sb = new StringBuffer();
Map<String, Object> map = new HashMap<String, Object>();
try {
String strOrder = ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " ASC";
cursor = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, strOrder);
int contactIdIdx = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone._ID);
int nameIdx = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME);
int phoneNumberIdx = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
int photoIdIdx = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.PHOTO_ID);
cursor.moveToFirst();
do {
String idContact = cursor.getString(contactIdIdx);
String name = cursor.getString(nameIdx);
String phoneNumber = cursor.getString(phoneNumberIdx);
//...
phoneNumber = getFormatedNumber(phoneNumber);
//as map key same phone number can not be two times
if(!map.containsKey(phoneNumber)) {
map.put(phoneNumber, null);
sb.append("\nPhone Number:--- " + phoneNumber + "\nUser Name:--- "
+ name);
sb.append("\n----------------------------------");
}
} while (cursor.moveToNext());
} catch (Exception e) {
e.printStackTrace();
} finally {
if (cursor != null) {
cursor.close();
}
}
textView.setText(sb); //As in output it shows one number showing two times
} catch (Exception e) {
e.printStackTrace();
}
}
private String getFormatedNumber(String number){
if(TextUtils.isEmpty(number))return null;
number = number.trim();
number = number.replaceAll("-", "");
number = number.replaceAll(" ", "");
return number;
}
After all discussion, I found the issue like the problem occur due to unicode character append in my string that is invisible while debugging but if we copied into notepad then it clearly visible. as like :
'\u202A\u202A+91922222222\u202A\u202C'

Looking for a appropraite logic

Actually I am using call logs as an input to database and then I am fetching it in a way that I can't get any duplicate values while displaying it and if i have any duplicate value in data base then it should be taken as integer value count. For example: john(6).
Here john must have entry 6 times in database. Don't get me wrong. I don't need a code.I need help. Here is code:
ContentResolver cr = getContentResolver();
Cursor cur = cr.query(android.provider.CallLog.Calls.CONTENT_URI,null, null, null, null);
if (cur.getCount() > 0) {
while (cur.moveToNext()) {
String rawContactId = cur.getString(cur.getColumnIndex(android.provider.CallLog.Calls._ID));
Cursor callLogCursor = getContentResolver().query(
android.provider.CallLog.Calls.CONTENT_URI, new String[]{
android.provider.CallLog.Calls.CACHED_NAME,
android.provider.CallLog.Calls.CACHED_NUMBER_LABEL,
android.provider.CallLog.Calls.NUMBER,
android.provider.CallLog.Calls.DATE,
android.provider.CallLog.Calls.DURATION,
android.provider.CallLog.Calls.TYPE
},android.provider.CallLog.Calls._ID + "=?", new String[] { rawContactId }, null);;
if (callLogCursor != null) {
while (callLogCursor.moveToNext()) {
//String id = callLogCursor.getString(0);
String name = callLogCursor.getString(0);
String cacheNumber = callLogCursor.getString(1);
String number = callLogCursor.getString(2);
long dateTimeMillis = callLogCursor.getLong(3);
long durationMillis = callLogCursor.getLong(4);
int callType = callLogCursor.getInt(5);
String duration = getDuration(durationMillis * 1000);
String dateString = getDateTime(dateTimeMillis);
if (cacheNumber == null)
cacheNumber = number;
if (name == null)
name = "Unknown";
Uri image = null;
try {
String conId = fetchContactIdFromPhoneNumber(cacheNumber);
long contId = Long.parseLong(conId);
image = getPhotoUri(contId);
}catch(Exception e) {
Log.e("Exception", e.getMessage());
}
//CallLogModel callLogModel = new CallLogModel(image, name, cacheNumber,
// duration, dateString);
ContentValues values = new ContentValues();
values.put(NAME, name);
values.put(NUMBER, cacheNumber);
values.put(DATE, dateString);
values.put(DURATION,duration );
database.insert(CALL_LOG_TABLE, null, values);
Cursor cursor = database.query(CALL_LOG_TABLE, new String [] {LOG_ID, NAME, NUMBER, DATE, DURATION}, null, null, null, null, null);
int row =0;
if(!cursor.isAfterLast()) {
cursor.moveToFirst();
do{
int pId=cursor.getInt(0);
String pName = cursor.getString(1);
String pNumber = cursor.getString(2);
String pDate = cursor.getString(3);
String pDuration = cursor.getString(4);
int value = 0;
CallLogModel callLogModel = new CallLogModel(image, name, cacheNumber, duration, dateString);
if (callType == CallLog.Calls.OUTGOING_TYPE) {
for(int i=0;i<outgoingList.size();i++){
------------------------------Actually i want Logic here what should i do here--------------
}
}
outgoingList.add(callLogModel);
} else if (callType == CallLog.Calls.INCOMING_TYPE) {
incomingList.add(callLogModel);
} else if (callType == CallLog.Calls.MISSED_TYPE) {
missedcallList.add(callLogModel);
}
cursor.moveToNext();
} while (!cursor.isAfterLast());
}
}
callLogCursor.close();
}
}
You could model the outgoing calls in a hashmap, something like:
Map<String, Integer> outgoingCallsMap = new HashMap<String, Integer>();
for (int i = 0; i < outgoingList.size(); i++) {
String nameOfCallee = outgoingList.get(i);
if (!outgoingCallsMap.containsKey(nameOfCallee)) {
outgoingCallsMap.put(nameOfCallee, 1);
} else {
//Increment calls to this person
outgoingCallsMap.put(nameOfCallee, outgoingCallsMap.get(nameOfCallee) + 1);
}
}
Remove the duplicates in your outGoingList, by iterating it and putting the result to a map, with contact name as key and list of CallLogModel object as value.
You can refer this method.
private void convertToOutGoingMap(List<CallLogModel > outGoingList) {
HashMap<String,List<CallLogModel>> outGoingMap = new HashMap<String, List<CallLogModel>>();//map which has CallLogModel.name as key and List<CallLogModel> as value.
for(CallLogModel model : outGoingList){//Iterate thru the list.
if(outGoingMap.containsKey(model.name))
{
outGoingMap.get(model.name).add(model);//if map contains key, add model to the list.
} else {
List<CallLogModel> modelList = new ArrayList<CallLogModel>();//if it does not contains, initialize a list and add model to it.
modelList.add(model);
outGoingMap.put(model.name, modelList);
}
}
}
}
The key set of this map gives you the unique call log names and corresponding value list gives all occurrences and its size gives you number of occurrences.
Hope this help you.

Android contact - does it have a unquieid?

Android contact - does each contact have a unquieid? How do I get the unquieid?
protected void getContactInfo(Intent intent)
{
Cursor cursor = managedQuery(intent.getData(), null, null, null, null);
while (cursor.moveToNext())
{
String contactId = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID));
name = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME));
String hasPhone = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER));
if ( hasPhone.equalsIgnoreCase("1"))
hasPhone = "true";
else
hasPhone = "false" ;
if (Boolean.parseBoolean(hasPhone))
{
Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = "+ contactId,null, null);
while (phones.moveToNext())
{
phoneNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
}
phones.close();
}
// Find Email Addresses
Cursor emails = getContentResolver().query(ContactsContract.CommonDataKinds.Email.CONTENT_URI,null,ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = " + contactId,null, null);
while (emails.moveToNext())
{
emailAddress = emails.getString(emails.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA));
}
emails.close();
Cursor address = getContentResolver().query(
ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_URI,
null,
ContactsContract.CommonDataKinds.StructuredPostal.CONTACT_ID + " = " + contactId,
null, null);
while (address.moveToNext())
{
// These are all private class variables, don't forget to create them.
poBox = address.getString(address.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.POBOX));
street = address.getString(address.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.STREET));
city = address.getString(address.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.CITY));
state = address.getString(address.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.REGION));
postalCode = address.getString(address.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE));
country = address.getString(address.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.COUNTRY));
type = address.getString(address.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.TYPE));
} //address.moveToNext()
} //while (cursor.moveToNext())
cursor.close();
}//getContactInfo

Categories