Note that there are some explanatory texts on larger screens.

plurals
  1. POCreate a pre filled contact with the standard Activity
    primarykey
    data
    text
    <p>In my app i'm trying to create a Contact by calling the standard Create/Edit contact Activity. </p> <p>I've found how to make it work but not exactly the way I like.</p> <p>For now I manage to call the standard create contact activity with the following intent extra:</p> <pre><code>Intent i = new Intent(ContactsContract.Intents.SHOW_OR_CREATE_CONTACT, Uri.parse(String.format("tel: %s", data.getPhone()))); i.addCategory(Intent.CATEGORY_DEFAULT); i.putExtra(ContactsContract.Intents.EXTRA_FORCE_CREATE, true); i.putExtra(ContactsContract.Intents.Insert.NAME, data.getName()); i.putExtra(ContactsContract.Intents.Insert.PHONE_TYPE, ContactsContract.CommonDataKinds.StructuredPostal.TYPE_WORK); i.putExtra(ContactsContract.Intents.Insert.PHONE, org.getPhone()); i.putExtra(ContactsContract.Intents.Insert.POSTAL_TYPE, ContactsContract.CommonDataKinds.StructuredPostal.TYPE_WORK); i.putExtra(ContactsContract.Intents.Insert.POSTAL, org.getAddress() + " " + org.getZipCode()); i.putExtra(ContactsContract.Intents.Insert.EMAIL_TYPE, ContactsContract.CommonDataKinds.StructuredPostal.TYPE_WORK); i.putExtra(ContactsContract.Intents.Insert.EMAIL, org.getEmail()); startActivity(i); </code></pre> <p>All the data is filled properly except the address field as you can see in the following picture: <a href="http://img689.imageshack.us/img689/1073/capturevvm.png" rel="nofollow">http://img689.imageshack.us/img689/1073/capturevvm.png</a></p> <p>I'd like to specify each part of the address in the separate field. Is there a way to do it with an Intent?</p> <p>I tried this, but it did not work.</p> <pre><code>i.putExtra(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE, ContactsContract.CommonDataKinds.StructuredPostal.TYPE_WORK); i.putExtra(ContactsContract.CommonDataKinds.StructuredPostal.STREET, "toto"); i.putExtra(ContactsContract.CommonDataKinds.StructuredPostal.CITY, "paris"); </code></pre> <p>Any idea?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload