Contacts First and Last name along with email id details in android
<p>I am using the following code to retrieve the contacts first and last name list from android however i also want to retrieve the email simultaneously:</p>

<pre><code>Cursor1 = getContentResolver().query(
           public List&lt;String&gt; getFullContactName()
           {
                List&lt;String&gt; name = new ArrayList&lt;String&gt;();
                String[] projection = new String[] {Data.DATA2, Data.DATA3};
                String where = Data.MIMETYPE + "='" + StructuredName.CONTENT_ITEM_TYPE + "'";
                Uri uri = Data.CONTENT_URI;

                ContentResolver contentResolver = getApplicationContext().getContentResolver();
                Cursor cursor = contentResolver.query(uri,projection,where,null,null);
                String firstName, lastName;
                while (cursor.moveToNext())
                {
                    firstName = cursor.getString(cursor.getColumnIndex(Data.DATA2));
                    lastName = cursor.getString(cursor.getColumnIndex(Data.DATA3));
                    name.add(firstName + " " + lastName);     
                    Toast.makeText(getApplicationContext(), "First name"+firstName, Toast.LENGTH_LONG).show();
                    Toast.makeText(getApplicationContext(), "Second name"+lastName, Toast.LENGTH_LONG).show();
                }

                cursor.close();
                cursor = null;
               return name;
            }
Cursor emails = getContentResolver().query(ContactsContract.CommonDataKinds.Email.CONTENT_URI, null, ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = " + contactId, null, null); 
   while (emails.moveToNext()) { 
      // This would allow you get several email addresses 
      String emailAddress = emails.getString( 
      emails.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA)); 
   } 
   emails.close();
}
cursor.close(); 
</code></pre>

<p>I need to know how can i read first name ,last name email, phone number together using a single Cursor because i need to fetch details in a  list and then display them in a listview. I havent got a reference where i can fetch the details using a single cursor.</p>
