android - add a contact opening the address book app -


what should if want add contact without saving it? example: want populate fields of address book values received app. when add contact whatsapp (it fills field of phone number doesn't save contact). in advance , sorry bad english.

update:

i've tried this, directly save it!

arraylist<contentprovideroperation> ops = new arraylist<contentprovideroperation>();     ops.add(contentprovideroperation.newinsert(             contactscontract.rawcontacts.content_uri)             .withvalue(contactscontract.rawcontacts.account_type, null)             .withvalue(contactscontract.rawcontacts.account_name, null)             .build());      // add contact name     ops.add(contentprovideroperation.newinsert(             contactscontract.data.content_uri)                           .withvaluebackreference(contactscontract.data.raw_contact_id, 0)             .withvalue(contactscontract.data.mimetype,contactscontract.commondatakinds.structuredname.content_item_type)             .withvalue(contactscontract.commondatakinds.structuredname.display_name,contatto).build()); try      {         getcontentresolver().applybatch(contactscontract.authority, ops);         toast.maketext(getapplicationcontext(),getresources().getstring(r.string.contattoaggiuntocorr),toast.length_long).show();         finish();     }      catch (exception e)      {                        e.printstacktrace();         toast.maketext(getapplicationcontext(), "exception: " + e.getmessage(), toast.length_long).show();     } 

solved!

i found solution!

public void insertcontact(string name, string email) { intent intent = new intent(intent.action_insert); intent.settype(contacts.content_type); intent.putextra(intents.insert.name, name); intent.putextra(intents.insert.email, email); if (intent.resolveactivity(getpackagemanager()) != null) {     startactivity(intent); } 

}


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -