i am getting all contact names and number bur i just want to show a number and a name which i choose.
here is the code which return all contacts :
ArrayList<String> contactList = new ArrayList<String>();
switch (reqCode) {
case (0):
if (resultCode == Activity.RESULT_OK) {
Uri uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI;
String[] projection = new String[] {
ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,
ContactsContract.CommonDataKinds.Phone.NUMBER };
Cursor people = getContentResolver().query(uri, projection,
null, null, null);
int indexName = people
.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME);
int indexNumber = people
.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
people.moveToFirst();
do {
String name = people.getString(indexName);
String number = people.getString(indexNumber);
String contact = name + "" + number;
contactList.add(contact);
} while (people.moveToNext());
}
in contactList
i want to add a number and a name