Hi Girish,

Thanks for the reply, But this is not what I am looking for.


Actually I am starting "contact" application from my application with
data [like Name, phone numbers(mobile,work,faxes, etc), Email etc)].

Now the problem is

1- I am *not* able to show Postal Address and the field which are
present in expandable list  [more section, that is in Android SDK 2.1]
2- I am *not* able to show more than 3 phone number
3- I am also *not* able to show more that 3 EMail Ids.


Thanks for the information. But If you know this then please share
with me.

Thanks,
AJ

On Apr 5, 1:10 pm, Girish <[email protected]> wrote:
> Hi,
>
> The above code is for 1.6 and below version, For Android 2.0 and above
> version you have to follow the below code,
> Cursor m_oCursor =
> this.getConetentResolver.query(ContactsContract.Contacts.CONTENT_URI,
> null, null, null, null);
> String pid =
> m_oCursor.getString(m_oCursor.getColumnIndex(ContactsContract.Contacts._ID));
> prn("PID:"+pid);
>
>                      //**********Retrieve Phone Numbers*********
>                 Cursor phoneCur =
> context.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
> null,
>                                 
> ContactsContract.CommonDataKinds.Phone.CONTACT_ID+"=\'"+pid+"\'",
> null, null);
>                 prn("Phone numbers count::"+phoneCur.getCount());
>                 if(phoneCur.moveToFirst()){
>                         do{
>                                 int phoneType =
> phoneCur.getInt(phoneCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE));
>                                 prn("Phone Type::"+phoneType);
>                                 phoneType(phoneType);
>
>                                 String phoneNumber =
> phoneCur.getString(phoneCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
>                                 prn("PhoneNumber::"+phoneNumber);
>
>                         }while(phoneCur.moveToNext());
>                 }
>                 phoneCur.close();
>                 phoneCur = null;
>
> Try this..
>
> Best wishes,
> Girish G M
>
> On Apr 5, 2:37 pm, Girish <[email protected]> wrote:
>
> > 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,ContactsCon­­tract.CommonDataKinds.Phone.TYPE_HOME);
>
> > > > i.putExtra(ContactsContract.Intents.Insert.TERTIARY_PHONE,  "333333");
> > > > i.putExtra(ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE,ContactsCont­­ract.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 -- 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.

Reply via email to