Email is not displayed in the List?
<p>The code I am using will display the <strong>Name and Number</strong> in the listview, but I need to display the Email also, for that I added some code snippet but Email didn't display in the listview. I am using Android 2.1 platform.</p>

<p><strong>CODE</strong></p>

<pre><code> public class Trial2 extends Activity {
/** Called when the activity is first created. */
private static final int CONTACT_PICKER_RESULT = 1001; 
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

       Button Btn = (Button)findViewById(R.id.button1);
        Btn.setOnClickListener(new View.OnClickListener() { 

            @Override 
            public void onClick(View v) {
                Intent i = new Intent(Intent.ACTION_PICK,ContactsContract.CommonDataKinds.Phone.CONTENT_URI);
                startActivityForResult(i, CONTACT_PICKER_RESULT);

            } 
        });
    }

    protected void onActivityResult(int reqCode, int resultCode, Intent data) { 
        super.onActivityResult(reqCode, resultCode, data);
        if(resultCode == RESULT_OK) {
            switch (reqCode) {
            case CONTACT_PICKER_RESULT:
                Cursor cursor = null;
                Cursor Emails = null;
                String number = "";
                String mailid;
                try {

                    Uri result = data.getData();

                    //get the id from the uri
                    String id = result.getLastPathSegment();  

                    //query
                    cursor = getContentResolver().query(
                            ContactsContract.CommonDataKinds.Phone.CONTENT_URI,null,ContactsContract.CommonDataKinds.Phone._ID + " = ? " , new String[] {id}, null);


                    int numberIdx = cursor.getColumnIndex(Phone.DATA);  

                    if(cursor.moveToFirst()) {
                        number = cursor.getString(numberIdx);

                    } else {

                    }

                     Emails = getContentResolver().query(Email.CONTENT_URI,null,Email.CONTACT_ID + " = " + id, null, null);

                     int emailid = Emails.getColumnIndex(Email.DATA);

                     if(Emails.moveToFirst()){

                         mailid =Emails.getString(emailid);
                     }else {

                    }



                } catch (Exception e) {
                    //failed 
                } finally {
                    if (cursor!=null) {
                        cursor.close();
                    }


                }

            }
        }
    }
}
</code></pre>

<p><strong>Xml file</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
 &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" &gt;

  &lt;Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Trial2" /&gt;



&lt;/LinearLayout&gt;
</code></pre>

<p>Solution ? Please.</p>
