adool adool - 1 month ago 9
Android Question

how can i get phone number of selected contact

c.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Intent i = new Intent(ContactsContract.Contacts.CONTENT_TYPE);
Intent i = new Intent(Intent.ACTION_PICK);
i.setType(ContactsContract.Contacts.CONTENT_TYPE);
startActivityForResult(i, CONTACT_PICKER_RESULT); }
});
}
public void onActivityResult(int requestCode ,int resultCode ,Intent data) {
if ((requestCode == CONTACT_PICKER_RESULT) && (resultCode == RESULT_OK)) {

}

}


This code contains the intent opens the contacts but I need if select contact take a contact phone number then set it to string

Answer Source

Check this solution: How to call Android contacts list? Its pretty much what you need to do but instead name you should search the number with the cursor.

PS: Next time search better, there is alot of people asking it.