title: Displaying contacts with EMAIL address only in android
body: <p>i am trying to build a app, where phone contacts only with email address has to be displayed to the user.When the user click on the editbox in my app,phone contacts only with email address has to be displayed,after the user selects a contact, the email address of that contact has to be sent back to my app, which i use it further in my app.</p>
  
  <p>//this is my code under  onActivityResult() method</p>
  
  <pre><code>          try 
              {
  
                  Uri result = data.getData();  
                  String id = result.getLastPathSegment();  
                  cursor = getContentResolver().query(Email.CONTENT_URI, null, Email.CONTACT_ID + "=?", new String[] { id }, null);  
                  emailIdx = cursor.getColumnIndex(Email.DATA);
  
                  if (cursor.moveToFirst()) 
                  {
                      while (cursor.isAfterLast() == false)
                      {
                          emailid = cursor.getString(emailIdx);
  
                          allids.add(emailid);
                          cursor.moveToNext();
                      }
                  } 
  
                  else 
                  {
                      //no results actions
                  }  
              } 
  </code></pre>
  
  <p>// This is the intent i am passing.</p>
  
  <pre><code>Intent intent = new Intent(Intent.ACTION_PICK,ContactsContract.Contacts.CONTENT_URI);
                  intent.setType(ContactsContract.CommonDataKinds.Email.ADDRESS);
  
                    startActivityForResult(intent, 1);
  </code></pre>
  
  <p>// manifest permissions.</p>
  
  <pre><code>            &lt;uses-permission android:name="android.permission.READ_CONTACTS" /&gt;
              &lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt;
  
  
              &lt;intent-filter&gt;
  
              &lt;action android:name="android.intent.action.PICK" /&gt;
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;data android:mimeType="vnd.android.cursor.dir/email_v2" /&gt;
              &lt;data android:mimeType="vnd.android.cursor.item/email_v2" /&gt;
  
              &lt;/intent-filter&gt;
  </code></pre>
  
  <p>i am getting the below error when i try to run my app.</p>
  
  <pre><code> android.content.ActivityNotFoundException: No Activity found to handle Intent {act=android.intent.action.PICK typ=data1 }         
  </code></pre>
  
  <p>I am not sure of what could be the problem, am i missing something in the manifest.xml?.please help.</p>
  
  <p>Thanks!</p>