Reputation: 3102
If I'm assigning a value to a field of a contact, such as nickname;
.withValue(Nickname.NAME, "Mr. Incredible")
it is stored in the DATA1 column according to http://developer.android.com/reference/android/provider/ContactsContract.CommonDataKinds.Nickname.html
Yet, if I add a SIP Address with SipAddress.SIP_ADDRESS() it's value is also assigned to column DATA1. How do I differentiate between these two? I'm a bit confused on how to access a contacts specific fields and I can't find an explanation in the Android Reference.
I'm specifically using
SimpleCursorAdapter(getActivity(),
R.layout.contact_list, null, new String[] {
SipAddress.DISPLAY_NAME, SipAddress.SIP_ADDRESS, Nickname.NAME},
new int[] {
R.id.text1, R.id.text2, R.id.text3}, 0);
Upvotes: 0
Views: 258
Reputation: 3536
Please try,
try {
Cursor cursor = getContentResolver().query(ContactsContract.Data.CONTENT_URI,
new String[]{ContactsContract.Data.DISPLAY_NAME},
ContactsContract.CommonDataKinds.Nickname.DATA1 + "=" + text, null, null);
cursor.moveToFirst();
String Nickname = cursor.getString(0);
}
catch (Exception e) {
}
Upvotes: 1
Reputation: 3536
Yes its saved in ContactsContract.DataColumns.DATA1
with the String SIP_ADDRESS
. May this helps you ContactsContract.CommonDataKinds.SipAddress
Happy coding!
Upvotes: 0