First fetch the _id of each contact and use that id in below URL to
fecth the all phone number of each contact.
//**********Retrieve Phone Numbers*********
Cursor numberCursor = context.getContentResolver().query
(Contacts.Phones.CONTENT_URI,
null,Contacts.ContactMethods.PERSON_ID +"=\'"+id+"\'",null,null);
// prn("numberCount::" +numberCursor.getCount());
if(numberCursor.moveToFirst()){
do{
int phoneType =
numberCursor.getInt(numberCursor.getColumnIndex(Contacts.Phones.TYPE));
// prn("Phone type::" +phoneType);
String phoneNumber =
numberCursor.getString(numberCursor.getColumnIndex(Contacts.Phones.NUMBER));
switch(phoneType)
{
case Contacts.Phones.TYPE_HOME:
// prn("Phone No(Home)");
break;
case Contacts.Phones.TYPE_MOBILE:
// prn("Phone No(Cell)");
break;
case Contacts.Phones.TYPE_WORK:
// prn("Phone No(Work)");
break;
case Contacts.Phones.TYPE_OTHER:
// prn("Phone No(Other)");
break;
case Contacts.Phones.TYPE_CUSTOM:
String
customLable=numberCursor.getString(numberCursor.getColumnIndex(Phones.LABEL));
if(customLable != null){
// prn("Phone
No(Custom):"+customLable);
}
break;
case Contacts.Phones.TYPE_FAX_HOME:
// prn("Phone No(Fax Home)");
break;
case Contacts.Phones.TYPE_FAX_WORK:
// prn("Phone No(Fax Work)");
break;
case Contacts.Phones.TYPE_PAGER:
// prn("Phone No(Pager)");
break;
}
}while(numberCursor.moveToNext());
}
numberCursor.close();
numberCursor = null;
This code help you to access the Phone number. Try this.
All the best,
Girish GM
On Apr 4, 6:33 pm, AJ <[email protected]> wrote:
> Any clue please regarding my 2 problem
>
> Thanks
> AJ
>
> On Apr 3, 7:00 pm, AJ <[email protected]> wrote:
>
>
>
> > Hi group
>
> > Now I am able to insert 3 phone numbers.
>
> > But There does not looks a way that How can I enter other phone
> > numbers like :- Work Fax, Home Fax, Pager etc.
>
> > Any clue please.
>
> > Here is the code what I have done:-
>
> > > > 1- How can I show multiple phone number [like Home, Mobile, Work etc]
> > > > when I am launching contact application. How can I do that?
>
> > ----------------------------------------
> > i.putExtra(ContactsContract.Intents.Insert.SECONDARY_PHONE,
> > "222222");
> > i.putExtra(ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE,ContactsContract.CommonDataKinds.Phone.TYPE_HOME);
>
> > i.putExtra(ContactsContract.Intents.Insert.TERTIARY_PHONE, "333333");
> > i.putExtra(ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE,ContactsContract.CommonDataKinds.Phone.TYPE_WORK);
>
> > --------------------------------------
>
> > On Apr 3, 6:30 pm, AJ <[email protected]> wrote:
>
> > > Any clues from experts.
>
> > > - AJ
>
> > > On Apr 3, 3:51 pm, AJ <[email protected]> wrote:
>
> > > > Hi Group,
>
> > > > I am able to launch contact application from the following way. I am
> > > > also able to show Name and only one Phone number. My problem is :-
>
> > > > 1- How can I show multiple phone number [like Home, Mobile, Work etc]
> > > > when I am launching contact application. How can I do that?
> > > > 2- In Contact application there is one option *More*, which is an
> > > > expandable list. When I click that it open with other many fields like
> > > > Notes, Website, Nicknam etc. How can I fill those fields while
> > > > launching the Contact application?
>
> > > > My code is as follows :-
>
> > > > -------------------------------- Code
> > > > --------------------------------
> > > > Intent intent = new Intent(Intent.ACTION_INSERT, People.CONTENT_URI);
>
> > > > intent.putExtra(Contacts.Intents.Insert.NAME, mFullName);
>
> > > > intent.putExtra(Contacts.Intents.Insert.PHONE, mPhoneMob);
> > > > intent.putExtra(Contacts.Intents.Insert.PHONE_TYPE,
> > > > Contacts.PhonesColumns.TYPE_MOBILE);
> > > > startActivity(intent);
> > > > -------------------------------- Code
> > > > --------------------------------
>
> > > > Any help is really appreciated.
> > > > Thanks,
> > > > AJ- Hide quoted text -
>
> - Show quoted text -
--
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
To unsubscribe, reply using "remove me" as the subject.