how to fetch android phone conatacts of a persion like home phone numer, work phone number, home email, work email and put it in the edittext?
<p>the following is my code, it is showing a persons phone number type with radio button selection,but it is not showing the emails, i need to select the email also`
    public void GetContacts() {
            Log.i(classTag, "ContactsButton On Click");
            Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
             intent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE);</p>

<pre><code>         startActivityForResult(intent, 1);   
       // Log.i(classTag, "contactIntent:"+contactPickerIntent);



    }

    protected void onActivityResult(int requestCode, int resultCode, Intent data) {  
         if (data != null) {
                Uri uri = data.getData();

                if (uri != null) {
                    Cursor c = null;
                    Cursor e=null;
                    try {


                         c = getContentResolver().query(uri, new String[]{ 
                                    ContactsContract.CommonDataKinds.Phone.NUMBER,  
                                    ContactsContract.CommonDataKinds.Phone.TYPE ,ContactsContract.CommonDataKinds.Email.DATA,ContactsContract.CommonDataKinds.Email.TYPE},
                                null, null, null);
                         String number=null;
                         int type=0;
                         String email=null;
                         String emailType=null;
                        if (c != null &amp;&amp; c.moveToFirst()) {
                            number = c.getString(0);
                            as=number;
                           type = c.getInt(1);
                           email=c.getString(2);
                           emailType=c.getString(3);
                            Log.i(classTag, "type is:"+type);
                            Log.i(classTag, "email is:"+email);
                            Log.i(classTag, "emailtype is:"+emailType);
                           // showSelectedNumber(type, number);
                            TelephonyManager tMgr =(TelephonyManager)getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
                            String iso=tMgr.getNetworkCountryIso();
                            Log.i("Device iso", "=======&gt;"+iso);
                            String mbNo=tMgr.getLine1Number();
                            Log.i("mbNo", "=======&gt;"+mbNo);

                               PhoneNumberFormat(number);
                               Intent i=new Intent(Contact.this, Tab.class);
                               i.putExtra("key", number);
                               Contact.this.startActivityForResult(i, 0);
                        }
                        Cursor emails = getContentResolver().query(ContactsContract.CommonDataKinds.Email.CONTENT_URI,null,ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = " + type,null, null);
                        Log.i(classTag, "emai:"+emails);
                        String emailAddress=null;
                        while (emails.moveToNext()) 
                        {
                        emailAddress =   emails.getString(emails.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA));
                         Log.i(classTag, "email is:"+emailAddress);
                        }
                     //  as=emailAddress;

                    } finally {
                        if (c != null) {
                            c.close();

                        }

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