Add postal address to contact

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

Add postal address to contact

Postby tjololo » Fri Mar 12, 2010 5:20 pm

Hi I have been trying for some time now to save a postal address to a new contact in my application, but can't figure it out.
I'm using sdk pre 2.0, (1.5 need to be compatible with my hero), so I can't use the ContactsContract class.
Here is my code to create a new contact and save name and phone number:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. ContentValues values = new ContentValues();
  2.  
  3. values.put(People.NAME, name);
  4.  
  5. Uri uri = People.createPersonInMyContactsGroup(getContentResolver(), values);
  6.  
  7. Uri newContact = Uri.withAppendedPath(uri,      People.Phones.CONTENT_DIRECTORY);
  8.  
  9. values.clear();
  10.  
  11. values.put(People.Phones.TYPE, People.Phones.TYPE_MOBILE);
  12.  
  13. values.put(People.Phones.NUMBER, number);
  14.  
  15. getContentResolver().insert(newContact, values);
  16.  
  17.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4

Any help would be appreciated!
tjololo
Freshman
Freshman
 
Posts: 2
Joined: Fri Mar 12, 2010 5:13 pm

Top

Postby Maximilian » Fri Mar 12, 2010 5:44 pm

Snail mail? Why don't you offer a telegraph feature too.
Maximilian
Junior Developer
Junior Developer
 
Posts: 19
Joined: Tue Mar 09, 2010 6:19 pm

Postby wally » Wed Mar 31, 2010 3:32 pm

Maximilian wrote:Snail mail? Why don't you offer a telegraph feature too.


That's not very helpful... I am having the same problem. I have tried any number of ways to do this and have had no luck. The documentation is pretty thin there and since this is deprecated for OS > 1.5, it probably won't be. Any help would be appreciated. BTW, Maximilian, just how do you navigate to an email address?

Wally
wally
Freshman
Freshman
 
Posts: 2
Joined: Wed Jan 20, 2010 4:00 pm
Location: Youngstown, OH

Top

Return to General

Who is online

Users browsing this forum: No registered users and 6 guests