I am using this code below to pick a contact number , but some contacts have more than one number, how can I select one of the contact numbers?
Cselect.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, 0);
}
});
In the result, you should get a Uri. From this, you will be able to grab a Cursor, and then iterate over the cursor to grab the information you require. I would advise you dump the cursor into the Logs so you can see what is returned, by using the
DatabaseUtilsclass.The following is a snippet of how you can retrieve the Cursor and iterate over it: