Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to set one number to default in android contact, but I don't know what I should write in place of Phone.NUMBER?
Java
ContentResolver cr = this.getContentResolver();

Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, projectionPhones,
    ContactsContract.CommonDataKinds.Phone.NUMBER +"=?", new String[]{"09183332222"}, null);

while(pCur.moveToNext())
{
    tv.setText(pCur.getString(1));
}

ContentValues values = new ContentValues();
values.put(Phone.DISPLAY_NAME, "Test");

// values.put(Phone.NUMBER  ,numberToCall);

values.put(Phone.NUMBER, numberToCall);

int phones = getContentResolver().update(ContactsContract.RawContacts.CONTENT_URI,values,
    Phone.CONTACT_ID +" = 1812", null);
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900