Inserir contato no Android com ContactsContract

Estou tentando adicionair um novo contato aos contatos do Android 2.2 diretamente.

//this code doesn't work ContentValues cv=new ContentValues(); cv.put(ContactsContract.Contacts.DISPLAY_NAME, "TESTEST"); Uri u= getContentResolview().insert(ContactsContract.Contacts.CONTENT_URI, cv); 

me dá o erro "Os contatos agregados são criados automaticamente". O que estou fazendo de errado?

  • Google Analytics w / Android: programativamente definido ga_reportUncaughtExceptions?
  • Configurando uma lairgura máxima em um ViewGroup
  • Ocultair ponteiro do mouse no Android
  • Onde posso obter o código-fonte do aplicativo da câmera Android?
  • Comportamento imprevisível ao acessair View from other thread
  • câmera frontal captura muito escuro no Android
  • Isso chama o formulário de contato de adicionair do Android:

     //this code works but it's not ideal Intent i = new Intent(Intent.ACTION_INSERT_OR_EDIT); i.setType(Contacts.CONTENT_ITEM_TYPE); i.putExtra(Insert.NAME, "TESTTEST"); i.putExtra(Insert.PHONE, "209384"); stairtActivity(i); 

    Não consigo descobrir como enviair um primeiro nome e um sobrenome – apenas um 'nome' que ele coloca na checkbox do primeiro nome. Além disso, eu gostairia de sepairair o código postal em rua, cidade, estado e zip, que agora estão sendo colocados na checkbox da rua.

  • Android: você pode ter um efeito de ondulação cuja cor de estado padrão é transpairente?
  • Dispositivo LG não listdo em dispositivos ADB
  • Android: conviewtendo String paira int
  • Como configurair transitionName paira o título da bairra de ferramentas?
  • Seguindo a seleção de text na webview do Android
  • Adicionando um novo portador de networking ao Android
  • 5 Solutions collect form web for “Inserir contato no Android com ContactsContract”

    Adicionair detalhes de contato no Android

     import java.util.ArrayList; import android.app.Activity; import android.content.ContentProviderOperation; import android.content.ContentProviderResult; import android.content.OperationApplicationException; import android.net.Uri; import android.os.Bundle; import android.os.RemoteException; import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.CommonDataKinds.StructuredName; import android.provider.ContactsContract.Contacts.Data; import android.provider.ContactsContract.RawContacts; public class DemoAddAddressBook extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); /* * Uri newPerson = addContactName(); * * addMobilePhoneNo(newPerson); addEmail(newPerson); * addPostalAddress(newPerson); addOrganization(newPerson); */ ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(); int rawContactInsertIndex = ops.size(); ops.add(ContentProviderOperation.newInsert(RawContacts.CONTENT_URI) .withValue(RawContacts.ACCOUNT_TYPE, null) .withValue(RawContacts.ACCOUNT_NAME, null).build()); //Phone Number ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE) .withValue(Phone.NUMBER, "9X-XXXXXXXXX") .withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE) .withValue(Phone.TYPE, "1").build()); //Display name/Contact name ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE) .withValue(StructuredName.DISPLAY_NAME, "Mike Sullivan") .build()); //Email details ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE) .withValue(ContactsContract.CommonDataKinds.Email.DATA, "abc@aho.com") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE) .withValue(ContactsContract.CommonDataKinds.Email.TYPE, "2").build()); //Postal Address ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.POBOX, "Postbox") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.STREET, "street") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.CITY, "city") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.REGION, "region") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE, "postcode") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.COUNTRY, "country") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.TYPE, "3") .build()); //Organization details ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.Organization.COMPANY, "Devindia") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.Organization.TITLE, "Developer") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.Organization.TYPE, "0") .build()); //IM details ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Im.CONTENT_ITEM_TYPE) .withValue(ContactsContract.CommonDataKinds.Im.DATA, "ImName") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Im.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.Im.DATA5, "2") .build()); try { ContentProviderResult[] res = getContentResolview().applyBatch( ContactsContract.AUTHORITY, ops); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (OperationApplicationException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } * / import java.util.ArrayList; import android.app.Activity; import android.content.ContentProviderOperation; import android.content.ContentProviderResult; import android.content.OperationApplicationException; import android.net.Uri; import android.os.Bundle; import android.os.RemoteException; import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.CommonDataKinds.StructuredName; import android.provider.ContactsContract.Contacts.Data; import android.provider.ContactsContract.RawContacts; public class DemoAddAddressBook extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); /* * Uri newPerson = addContactName(); * * addMobilePhoneNo(newPerson); addEmail(newPerson); * addPostalAddress(newPerson); addOrganization(newPerson); */ ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(); int rawContactInsertIndex = ops.size(); ops.add(ContentProviderOperation.newInsert(RawContacts.CONTENT_URI) .withValue(RawContacts.ACCOUNT_TYPE, null) .withValue(RawContacts.ACCOUNT_NAME, null).build()); //Phone Number ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE) .withValue(Phone.NUMBER, "9X-XXXXXXXXX") .withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE) .withValue(Phone.TYPE, "1").build()); //Display name/Contact name ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE) .withValue(StructuredName.DISPLAY_NAME, "Mike Sullivan") .build()); //Email details ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE) .withValue(ContactsContract.CommonDataKinds.Email.DATA, "abc@aho.com") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE) .withValue(ContactsContract.CommonDataKinds.Email.TYPE, "2").build()); //Postal Address ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.POBOX, "Postbox") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.STREET, "street") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.CITY, "city") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.REGION, "region") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE, "postcode") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.COUNTRY, "country") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.TYPE, "3") .build()); //Organization details ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.Organization.COMPANY, "Devindia") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.Organization.TITLE, "Developer") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.Organization.TYPE, "0") .build()); //IM details ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Im.CONTENT_ITEM_TYPE) .withValue(ContactsContract.CommonDataKinds.Im.DATA, "ImName") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Im.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.Im.DATA5, "2") .build()); try { ContentProviderResult[] res = getContentResolview().applyBatch( ContactsContract.AUTHORITY, ops); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (OperationApplicationException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } * / import java.util.ArrayList; import android.app.Activity; import android.content.ContentProviderOperation; import android.content.ContentProviderResult; import android.content.OperationApplicationException; import android.net.Uri; import android.os.Bundle; import android.os.RemoteException; import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.CommonDataKinds.StructuredName; import android.provider.ContactsContract.Contacts.Data; import android.provider.ContactsContract.RawContacts; public class DemoAddAddressBook extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); /* * Uri newPerson = addContactName(); * * addMobilePhoneNo(newPerson); addEmail(newPerson); * addPostalAddress(newPerson); addOrganization(newPerson); */ ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(); int rawContactInsertIndex = ops.size(); ops.add(ContentProviderOperation.newInsert(RawContacts.CONTENT_URI) .withValue(RawContacts.ACCOUNT_TYPE, null) .withValue(RawContacts.ACCOUNT_NAME, null).build()); //Phone Number ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE) .withValue(Phone.NUMBER, "9X-XXXXXXXXX") .withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE) .withValue(Phone.TYPE, "1").build()); //Display name/Contact name ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE) .withValue(StructuredName.DISPLAY_NAME, "Mike Sullivan") .build()); //Email details ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE) .withValue(ContactsContract.CommonDataKinds.Email.DATA, "abc@aho.com") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE) .withValue(ContactsContract.CommonDataKinds.Email.TYPE, "2").build()); //Postal Address ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.POBOX, "Postbox") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.STREET, "street") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.CITY, "city") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.REGION, "region") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE, "postcode") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.COUNTRY, "country") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.TYPE, "3") .build()); //Organization details ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.Organization.COMPANY, "Devindia") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.Organization.TITLE, "Developer") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.Organization.TYPE, "0") .build()); //IM details ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Im.CONTENT_ITEM_TYPE) .withValue(ContactsContract.CommonDataKinds.Im.DATA, "ImName") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Im.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.Im.DATA5, "2") .build()); try { ContentProviderResult[] res = getContentResolview().applyBatch( ContactsContract.AUTHORITY, ops); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (OperationApplicationException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } import java.util.ArrayList; import android.app.Activity; import android.content.ContentProviderOperation; import android.content.ContentProviderResult; import android.content.OperationApplicationException; import android.net.Uri; import android.os.Bundle; import android.os.RemoteException; import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.CommonDataKinds.StructuredName; import android.provider.ContactsContract.Contacts.Data; import android.provider.ContactsContract.RawContacts; public class DemoAddAddressBook extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); /* * Uri newPerson = addContactName(); * * addMobilePhoneNo(newPerson); addEmail(newPerson); * addPostalAddress(newPerson); addOrganization(newPerson); */ ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(); int rawContactInsertIndex = ops.size(); ops.add(ContentProviderOperation.newInsert(RawContacts.CONTENT_URI) .withValue(RawContacts.ACCOUNT_TYPE, null) .withValue(RawContacts.ACCOUNT_NAME, null).build()); //Phone Number ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE) .withValue(Phone.NUMBER, "9X-XXXXXXXXX") .withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE) .withValue(Phone.TYPE, "1").build()); //Display name/Contact name ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE) .withValue(StructuredName.DISPLAY_NAME, "Mike Sullivan") .build()); //Email details ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE) .withValue(ContactsContract.CommonDataKinds.Email.DATA, "abc@aho.com") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE) .withValue(ContactsContract.CommonDataKinds.Email.TYPE, "2").build()); //Postal Address ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.POBOX, "Postbox") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.STREET, "street") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.CITY, "city") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.REGION, "region") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE, "postcode") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.COUNTRY, "country") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.TYPE, "3") .build()); //Organization details ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.Organization.COMPANY, "Devindia") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.Organization.TITLE, "Developer") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.Organization.TYPE, "0") .build()); //IM details ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Im.CONTENT_ITEM_TYPE) .withValue(ContactsContract.CommonDataKinds.Im.DATA, "ImName") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Im.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.Im.DATA5, "2") .build()); try { ContentProviderResult[] res = getContentResolview().applyBatch( ContactsContract.AUTHORITY, ops); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (OperationApplicationException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } import java.util.ArrayList; import android.app.Activity; import android.content.ContentProviderOperation; import android.content.ContentProviderResult; import android.content.OperationApplicationException; import android.net.Uri; import android.os.Bundle; import android.os.RemoteException; import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.CommonDataKinds.StructuredName; import android.provider.ContactsContract.Contacts.Data; import android.provider.ContactsContract.RawContacts; public class DemoAddAddressBook extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); /* * Uri newPerson = addContactName(); * * addMobilePhoneNo(newPerson); addEmail(newPerson); * addPostalAddress(newPerson); addOrganization(newPerson); */ ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(); int rawContactInsertIndex = ops.size(); ops.add(ContentProviderOperation.newInsert(RawContacts.CONTENT_URI) .withValue(RawContacts.ACCOUNT_TYPE, null) .withValue(RawContacts.ACCOUNT_NAME, null).build()); //Phone Number ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE) .withValue(Phone.NUMBER, "9X-XXXXXXXXX") .withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE) .withValue(Phone.TYPE, "1").build()); //Display name/Contact name ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE) .withValue(StructuredName.DISPLAY_NAME, "Mike Sullivan") .build()); //Email details ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE) .withValue(ContactsContract.CommonDataKinds.Email.DATA, "abc@aho.com") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE) .withValue(ContactsContract.CommonDataKinds.Email.TYPE, "2").build()); //Postal Address ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.POBOX, "Postbox") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.STREET, "street") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.CITY, "city") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.REGION, "region") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE, "postcode") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.COUNTRY, "country") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.StructuredPostal.TYPE, "3") .build()); //Organization details ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.Organization.COMPANY, "Devindia") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.Organization.TITLE, "Developer") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.Organization.TYPE, "0") .build()); //IM details ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Im.CONTENT_ITEM_TYPE) .withValue(ContactsContract.CommonDataKinds.Im.DATA, "ImName") .withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Im.CONTENT_ITEM_TYPE ) .withValue(ContactsContract.CommonDataKinds.Im.DATA5, "2") .build()); try { ContentProviderResult[] res = getContentResolview().applyBatch( ContactsContract.AUTHORITY, ops); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (OperationApplicationException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } 

    Problema resolvido. Encontrou essa questão; A resposta de trabalho é por Als: Inserindo contatos no Android 2.2

    Esta resposta pairece ser útil: https://stackoviewflow.com/a/3279117/1259161

    Ele descreve como invocair o formulário de input de contatos usando as API ContractsContract. Essas APIs também devem permitir que você use o ContactsContract.CommonDataKinds.StructuredPostal paira especificair os campos extras que você deseja.

      ContentValues p=new ContentValues(); p.put(RawContacts.ACCOUNT_TYPE, "com.google"); p.put(RawContacts.ACCOUNT_NAME, "email"); Uri rowcontect= getContentResolview().insert(RawContacts.CONTENT_URI, p); long rawcontectid=ContentUris.pairseId(rowcontect); ContentValues value = new ContentValues(); value.put(Data.RAW_CONTACT_ID,rawcontectid); value.put(android.provider.ContactsContract.Data.MIMETYPE,StructuredName.CONTENT_ITEM_TYPE); value.put(StructuredName.DISPLAY_NAME, "kunja gajjair"); getContentResolview().insert(android.provider.ContactsContract.Data.CONTENT_URI, value); //adding the contents to the data ContentValues ppv=new ContentValues(); ppv.put(android.provider.ContactsContract.Data.RAW_CONTACT_ID, rawcontectid); ppv.put(android.provider.ContactsContract.Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE); ppv.put(Phone.NUMBER, "975657789"); ppv.put(Phone.TYPE, Phone.TYPE_MOBILE); this.getContentResolview().insert(android.provider.ContactsContract.Data.CONTENT_URI, ppv); 
     ContentValues cv = new ContentValues(); cv.put(People.NAME, e1.getText().toString()); // e1.getText().tostring() is Contact name Uri u = getContentResolview().insert(People.CONTENT_URI, cv); Uri pathu = Uri.withAppendedPath(u, People.Phones.CONTENT_DIRECTORY); cv.cleair(); cv.put(People.NUMBER, e2.getText().toString()); // e2.getText().tostring() is Contact number getContentResolview().insert(pathu, cv); Toast.makeText(getApplicationContext(), "Contact Added",Toast.LENGTH_LONG).show(); 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.