Note that there are some explanatory texts on larger screens.

plurals
  1. POpick number,email id and name from contact in android
    primarykey
    data
    text
    <p>I am working with phone contacts. I want to pick a contact from the contact list when i click the button and get all the contact information like <strong>name,email and phone number</strong>.i just got email and name of the contact ,but can't get the phone number.my code is give below.</p> <pre><code> Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,Contacts.CONTENT_URI); startActivityForResult(contactPickerIntent, PICK_CONTACT); } }); } @Override public void onActivityResult(int reqCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { switch (reqCode) { case PICK_CONTACT: Cursor cursor = null; String email = "", name = ""; try { Uri result = data.getData(); //Log.v(DEBUG_TAG, "Got a contact result: " + result.toString()); // get the contact id from the Uri String id = result.getLastPathSegment(); // query for everything email cursor = getContentResolver().query(Email.CONTENT_URI, null, Email.CONTACT_ID + "=?", new String[] { id }, null); int nameId = cursor.getColumnIndex(Contacts.DISPLAY_NAME); int emailIdx = cursor.getColumnIndex(Email.DATA); if (cursor.moveToFirst()) { email = cursor.getString(emailIdx); name = cursor.getString(nameId); } else { // Log.w(DEBUG_TAG, "No results"); } } catch (Exception e) { // Log.e(DEBUG_TAG, "Failed to get email data", e); } finally { if (cursor != null) { cursor.close(); } System.out.println(email); System.out.println(name); if (email.length() == 0 &amp;&amp; name.length() == 0) { Toast.makeText(this, "No Email for Selected Contact",Toast.LENGTH_LONG).show(); } } break; } } else { } } } </code></pre> <p>here i can get email and name of the selected user.i need to get email,phonenumber and name of the selected user help me please.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload