1. Download our Official Android App: Forums for Android!

Apps How can i show a prefilled contacts screen on android 2.0?

Discussion in 'Android Development' started by sagare, Mar 9, 2010.

  1. sagare

    sagare Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    1
    Joined:
    Mar 9, 2010

    Mar 9, 2010
    1
    0
    5
    Hi All,
    I know the code below opens the native Edit/Add contact screen

    Intent newIntent = new Intent(Intent.ACTION_INSERT,
    ContactsContract.Contacts.CONTENT_URI);
    startActivityForResult(newIntent, 1);

    now i want this screen to be populated with some data in fields like
    name, phone number, address etc. I found that if i do something like
    newIntent.putExtra(ContactsContract.Intents.Insert.NAME, "Some
    Name");
    will show this screen with name "Some Name" being shown in the name
    field this is fine for me now i dont understand how will i fill the
    city, state and zip fields similarly.
    I found the ContactsContract.Intents.Insert has a
    POSTAL attribute for address but there are no specific attributes for
    city, state and zip in ContactsContract.Intents.Insert.
    Also i found that
    ContactsContract.CommonDataKinds.StructuredPostal has the city, state
    and zip attributes but still i dont know how can i use this to
    prepopulate the Edit/Add contact screen with values of city, state
    and zip.

    Please Help me with this,
    Sagar
     

    Advertisement

  2. maxart

    maxart Lurker
    Rank:
    None
    Points:
    5
    Posts:
    4
    Joined:
    Dec 30, 2010

    Dec 30, 2010
    4
    0
    5
    intent.putExtra(ContactsContract.Intents.Insert.EMAIL, "foo.bar@foobar.com");
    intent.putExtra(ContactsContract.Intents.Insert.PHONE, "(123) 111-1212");
    intent.putExtra(ContactsContract.Intents.Insert.PHONE_TYPE, "HOME-1");
    intent.putExtra(ContactsContract.Intents.Insert.SECONDARY_PHONE, "(123) 222-2121");
    intent.putExtra(ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, "HOME-2");
    intent.putExtra(ContactsContract.Intents.Insert.NOTES, "Met at off price");
     
  3. star007

    star007 Lurker
    Rank:
    None
    Points:
    25
    Posts:
    3
    Joined:
    Dec 27, 2011

    Dec 27, 2011
    3
    0
    25
    Hi All,
    I know the code below opens the native Edit/Add contact screen

    Intent newIntent = new Intent(Intent.ACTION_INSERT,
    ContactsContract.Contacts.CONTENT_URI);
    startActivityForResult(newIntent, 1);

    now i want this screen to be populated with some data in fields like
    name, phone number, address etc. I found that if i do something like
    newIntent.putExtra(ContactsContract.Intents.Insert .NAME, "Some
    Name");
    will show this screen with name "Some Name" being shown in the name
    field this is fine for me now i dont understand how will i fill the
    first name, last name , city, state and zip fields similarly.
    I found the ContactsContract.Intents.Insert has a
    POSTAL attribute for address but there are no specific attributes for
    first name, last name, city, state and zip in ContactsContract.Intents.Insert.
    Also i found that
    ContactsContract.CommonDataKinds.StructuredPostal has the first name, last name, city, state
    and zip attributes but still i dont know how can i use this to
    prepopulate the Edit/Add contact screen with values of first name, last name, city, state
    and zip.

    Please Help me with this,
    star
     

Share This Page

Loading...