Retrieve Email Id from contacts

by Deepak » Thu, 19 Jun 2008 13:49:15 GMT


Sponsored Links
 ello All,

Does anyone know how to retrieve email ids from added contacts.

I was able to add email ids programmatically using the following code
snippet below, but I could not retrieve it ! :(

try {
ContentValues person = new ContentValues();
person.put(Contacts.People.NAME, "Smith John,
Mr.");
person.put(Contacts.People.COMPANY, "Test
Company");
person.put(Contacts.People.NOTES, "eNotes");

Uri newPerson =
PhoneBook.this.getContentResolver().insert(
Contacts.People.CONTENT_URI,
person);

if (newPerson != null) {
List pathList =
newPerson.getPathSegments();
String pathLeaf = (String) pathList
.get(pathList.size() -
1);

// add mobile phone number
ContentValues number = new
ContentValues();
number.put(Contacts.Phones.PERSON_ID,
pathLeaf);
number.put(Contacts.Phones.NUMBER,
"(408) 111-1111");
number.put(Contacts.Phones.TYPE,

Contacts.Phones.MOBILE_TYPE);
Uri phoneUpdate =
PhoneBook.this.getContentResolver()

.insert(Contacts.Phones.CONTENT_URI, number);
if (phoneUpdate == null) {
throw new Exception(
"Failed to
insert mobile phone number");
}

// add fax number
number = new ContentValues();
number.put(Contacts.Phones.PERSON_ID,
pathLeaf);
number.put(Contacts.Phones.NUMBER,
"(408) 111-1111-1");
number.put(Contacts.Phones.TYPE,

Contacts.Phones.WORK_FAX_TYPE);
phoneUpdate =
PhoneBook.this.getContentResolver().insert(

Contacts.Phones.CONTENT_URI, number);
if (phoneUpdate == null) {
throw new Exception("Failed to
insert work fax number");
}

// add email
ContentValues email = new
ContentValues();

email.put(Contacts.ContactMethods.PERSON_ID, pathLeaf);
email.put(Contacts.ContactMethods.KIND,

Contacts.ContactMethods.EMAIL_KIND);
email.put(Contacts.ContactMeth



Retrieve Email Id from contacts

by Deepak » Fri, 20 Jun 2008 01:25:16 GMT


 ah ! I actually found the solution ! :)


On Jun 19, 6:48pm, Deepak <[EMAIL PROTECTED]> wrote:
--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Retrieve Email Id from contacts

by Kumar app » Fri, 20 Jun 2008 05:55:34 GMT


 ould you please share to the community...


On Fri, Jun 20, 2008 at 6:55 AM, Deepak <[EMAIL PROTECTED]> wrote:



--
--
Adios,
kokki a.k.a Kumar.A.P.P
Http://sapped.wordpress.com

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Attaching to DDMS

I am trying to build my own IDE to write android apps (to get rid of
eclipse eventually) and I am not sure how to debug.

OK to build, I got the apk, but what do I do after I have connected to
port 8700 to DDMS ? Is there a description of the protocol that DDMS
uses so I can use it programmatically in my IDE ?

Thanks.

-- 

2. Questions/Help with Long Running Service Please




A service can be killed at any point by the system to conserve memory.



You can help keep your service alive longer by making it foreground and
showing a notification, but even that is not bullet proof. Always assume
your service will be killed at any point - because it can and probably will,
eventually.

That being said, if you set an alarm to re-trigger the Service on each
start, it should keep going, theoretically. I don't suppose you're turning
your phone off? Because all alarms are lost if you do.

-------------------------------------------------------------------------------------------------
TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
transit tracking app for Android-powered devices

-- 

3. Calling a MapActivity from another activity

4. Live Wallpaper configuration

5. LocationManager/Listener, use gps data

6. integrating skyhook in android application

7. listview single resizeable button