Hello friends.

I'm using this code to pick a contact:


         Intent i = new Intent(Intent.ACTION_PICK,
People.CONTENT_URI);
          startActivityForResult(i, PICK_CONTACT_FROM_LIST);


And this to read the phone numbers of the picked contact:


     protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          if (requestCode == PICK_CONTACT_FROM_LIST)
               if (resultCode == RESULT_OK)
               {
                    String [] proj=
{PhonesColumns.NUMBER,PhonesColumns.TYPE};
                    Cursor cursor = managedQuery(data.getData
(),proj,"type=2",null,null); // mobile
                    if (cursor.getCount() > 0)
                    {
                         // some code
                    }
               }
     }


But when the first phone number is not the mobile one (type=2) I get
no rows. If I remove the where clause from the query, I get only one
phone number (the first one) no matter how many phone numbers the
contact has.

Is there something I need to change in the intent or somewhere else to
be able to retrieve the mobile phone number when it is not the first
phone number of the contact ?

Thanks, and regards.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to