Using following code I was able to add email and phone number..

Intent addEmailToContactIntent = new Intent
(Intent.ACTION_INSERT_OR_EDIT);
                addEmailToContactIntent.putExtra
(Contacts.Intents.Insert.EMAIL, Uri.decode(extra));
                addEmailToContactIntent.setType
(Contacts.People.CONTENT_ITEM_TYPE);


Intent addphIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
                addphIntent.putExtra(Insert.PHONE, Uri.decode(extra));
                addphIntent.setType
(Contacts.People.CONTENT_ITEM_TYPE);

On Jul 22, 3:29 pm, jats1234 <jats1...@gmail.com> wrote:
> I also tried INSERT_EDIT action, but using that I get activity not
> found exception. Is there a proecess to let Google know about this?
> Please help..
>
> On Jul 21, 7:35 am, Yorgos <yorg...@gmail.com> wrote:
>
>
>
> > Hi, has anyone find how to deal with this issue?
>
> > cheers!!
>
> > On 18 Ιούλ, 01:11,jats1234<jats1...@gmail.com> wrote:
>
> > > I am having the same issue. Hope it gets fix soon...
>
> > > On Jun 11, 2:45 pm, John Seghers <jsegh...@cequint.com> wrote:
>
> > > > I followed the documentation to start the Show or Create Contact
> > > > activity.  Since my app asks the user if they want to add a contact, I
> > > > don't want the activity asking this as well.  Thus I used 
> > > > theEXTRA_FORCE_CREATEflag.
>
> > > > If I do not use this flag, the code below works fine. It asks the user
> > > > if they want to add the contact, brings up a selection list where they
> > > > can choose an existing contact or create a new one, and then shows the
> > > > add contacts UI.
>
> > > >     Intent intent = new Intent();
> > > >     intent.setAction(Contacts.Intents.SHOW_OR_CREATE_CONTACT);
> > > >     intent.addCategory(Intent.CATEGORY_DEFAULT);
> > > >     intent.setData(Uri.fromParts("tel", "2065551234", null));
> > > >     intent.putExtra(Contacts.Intents.EXTRA_FORCE_CREATE, true); //
> > > > <<<<<< this is the problem line
> > > >     intent.putExtra(Contacts.Intents.Insert.NAME, "Cequint");
> > > >     intent.putExtra(Contacts.Intents.Insert.NOTES, "test");
> > > >     intent.putExtra(Contacts.Intents.Insert.PHONE_TYPE,
> > > > Contacts.PhonesColumns.TYPE_WORK);
> > > >     startActivity(intent);
>
> > > > Using theEXTRA_FORCE_CREATEflag, the activity does not start and the
> > > > logcat output shows that the intent forwarded by the
> > > > ShowOrCreateActivity fails:
>
> > > > 06-11 19:00:33.198: INFO/ActivityManager(583): Starting activity:
> > > > Intent { action=com.android.contacts.action.SHOW_OR_CREATE_CONTACT
> > > > categories={android.intent.category.DEFAULT} data=tel:2065551234 comp=
> > > > {com.android.contacts/com.android.contacts.ShowOrCreateActivity} (has
> > > > extras) }
> > > > 06-11 19:00:33.369: INFO/ActivityManager(583): Starting activity:
> > > > Intent { action=android.intent.action.INSERT
> > > > type=vnd.android.cursor.dir/person comp={com.android.contacts/
> > > > com.android.contacts.EditContactActivity} (has extras) }
> > > > 06-11 19:00:33.459: DEBUG/UserLaunch:(992): onRestart()
> > > > 06-11 19:00:33.479: DEBUG/UserLaunch:(992): onStart()
> > > > 06-11 19:00:33.709: ERROR/EditContactActivity(862): Cannot resolve
> > > > intent: Intent { action=android.intent.action.INSERT
> > > > type=vnd.android.cursor.dir/person comp={com.android.contacts/
> > > > com.android.contacts.EditContactActivity} (has extras) }
>
> > > > Looking at the Contacts Manifest, I found that sending this Intent
> > > > would take me directly to the add contacts UI, but will always create
> > > > a new contact even if there is already one for that number:
>
> > > >     Intent intent = new Intent(Intent.ACTION_INSERT,
> > > > People.CONTENT_URI);
> > > >     intent.putExtra(Contacts.Intents.Insert.PHONE, "2065551234");
> > > >     intent.putExtra(Contacts.Intents.Insert.NAME, "Cequint");
> > > >     intent.putExtra(Contacts.Intents.Insert.NOTES, "test");
> > > >     intent.putExtra(Contacts.Intents.Insert.PHONE_TYPE,
> > > > Contacts.PhonesColumns.TYPE_WORK);
> > > >     startActivity(intent);
>
> > > > Am I doing something wrong with the first example? Or is there a bug
> > > > in the Contacts app? This is with SDK 1.5 r2.- 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 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