If you want to stick with old Contacts APIs, use the Contacts.Phones table.

However, you might want to upgrade to the new Contacts APIs.
Continuing to use old APIs on the Eclair phones limits you to only one
account - basically your app may see only some contacts or none at all
on an Eclair phone.  See this document for how to deal with phone
numbers using the new API:

http://developer.android.com/reference/android/provider/ContactsContract.Data.html

and also this example of how to build an application that uses old
Contacts API on pre-Eclair phones and the new API on Eclair and
beyond:

http://code.google.com/p/android-business-card/source/browse/#svn/trunk/android-business-card/BusinessCard/src/com/example/android/businesscard


I hope this helps,
- Dmitri

On Wed, Dec 9, 2009 at 10:41 AM, vendor.net <[email protected]> wrote:
> Hi all!
>
> I am using this code to get the phone from the android address book:
>
> Uri myContactURI = Uri.withAppendedPath(Contacts.People.CONTENT_URI,
> "Some contact ID");
> Cursor cur = managedQuery(myContactURI, null, null, null, null);
>
> if (cur.moveToFirst()) {
>                Log.d("DEBUGTAG", "first");
>                String name;
>                String phoneNumber;
>                int nameColumn = cur.getColumnIndex(People.NAME);
>                int phoneColumn = cur.getColumnIndex(People.NUMBER);
>
>                String imagePath;
>
>                do {
>                    // Get the field values
>                    name = cur.getString(nameColumn);
>                    phoneNumber = cur.getString(phoneColumn);
>
>                    // Do something with the values.
>                    Log.d("DEBUGTAG", "Contact: name:" + name +" phone:"+
> phoneNumber);
>
>                } while (cur.moveToNext());
> }
>
> But all I get is the default phone. I want to get all phone numbers
> including those who have TYPE_OTHER.
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

Reply via email to