Note that there are some explanatory texts on larger screens.

plurals
  1. POquery to get email , contact name , and number in 1 line of code
    primarykey
    data
    text
    <p>nullim using Cursor cursor = getContentResolver() .query(contactUri, projection, null,null,null); to get the number of clicked contact. Is it possible to get the email, number and name using this query. at the same time? can we do it this way? as shown below?</p> <pre><code> String[] projection = {Phone.NUMBER}; String[] projection1 = {Email.DATA}; String[] projection2 = {Contacts.DISPLAY_NAME}; Cursor cursor = getContentResolver(). query(contactUri, projection, null,projection1,projection2); cursor.moveToFirst(); int column = cursor.getColumnIndex(Phone.NUMBER); int column1 = cursor.getColumnIndex(Email.DATA); int column2= cursor.getColumnIndex(Contacts.DISPLAY_NAME); String number = cursor.getString(column); String email1 = cursor.getString(column1); String name1 = cursor.getString(column2) </code></pre> <p>is this possible?</p> <p>Is this correct now?</p> <pre><code> String[] projection = {Phone.NUMBER, Email.ADDRESS, Contacts.DISPLAY_NAME}; Cursor cursor = getContentResolver(). query(contactUri, projection, null,null,null); cursor.moveToFirst(); int column = cursor.getColumnIndex(Phone.NUMBER); int column1 = cursor.getColumnIndex(Email.ADDRESS); int column2= cursor.getColumnIndex(Contacts.DISPLAY_NAME); String number = cursor.getString(column); String email1 = cursor.getString(column1); String name1 = cursor.getString(column2) editText3 = (EditText) findViewById(R.id.editText3); editText17 = (EditText) findViewById(R.id.editText17); editText3.setText(number); editText17.setText(email1); </code></pre> <p>only the phone number is getting set in the text box edittext3 and edittext17 both have mobile number? what an i doing wrong? thank you</p>
    singulars
    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.
    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