Insert last name contacts using intreat android

Google really needs to document its contact API, which is very annoying to learn how to embed specific details.

Anyway,

I want to send the following contact information to Contact my own android application:

  • Name
  • Surname [Surname]
  • Street address
  • Town
  • State
  • Postcode
  • contact phone number

I realized that the last name is stored in ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME

Anyhelp will really be appreciated. And if you know any other column insertions other than those listed above. I am ready to buy it. Only condition is that it must use ContactsContract, i.e. above the level of Android API version 5

Thankx :)

+4
source share
2 answers

To set the name, your code will look like this:

 ConactsIntent.putExtra(ContactsContract.Intents.Insert.NAME, firstName); 

Try adding a space between the first and last name.

 ConactsIntent.putExtra(ContactsContract.Intents.Insert.NAME, firstName+" "+lastName); 
+1
source
 ContactsContract.CommonDataKinds.StructuredPostal.STREET ContactsContract.CommonDataKinds.StructuredPostal.CITY ContactsContract.CommonDataKinds.StructuredPostal.REGION ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE ContactsContract.CommonDataKinds.Phone.NUMBER 

You will find everything here .

0
source

Source: https://habr.com/ru/post/1332733/


All Articles