PDA

View Full Version : Help me with Accessing Contact information



jashachik
06-06-2011, 08:47 PM
I am currently trying to write an app that accesses my contacts numbers. I did not know how to do it so instead I used:
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:##########"));
startActivity(intent);
which brings up the dialer and inputs the 10 digit number into it. I would much rather not hard code it, and instead be able to find where it is saved within my phone. Any help is great! thank you!

CR6
06-06-2011, 09:12 PM
Not sure if this is what you're looking for but I've got a shortcut on one of my homepages for that. Just long press on an empty spot on the homepage you'd like it on, when the menu of options comes up, click on "applications", scroll down and click on "contacts". If you're not happy with the stock icon, long press on it to change.


Tapatalker!

jashachik
06-06-2011, 09:23 PM
I don't know if I worded my question right. I'm trying to find out if you can write the code like (Intent.ACTION_DIAL, contacts.getNumber();) or something along those lines. If something like that is possible.

furbearingmammal
06-06-2011, 09:26 PM
I think you're asking a development question. If so, as in you are trying to become a developer, then I'll move this thread to the appropriate location so you get the right visibility.

CR6
06-06-2011, 09:27 PM
I'm sorry bud....i misunderstood your question. Sorry, i can't help with this one but hopefully one of our many knowledgeable members can.
Good luck and let us know how it turns out!
:)


Tapatalker!

jashachik
06-06-2011, 09:27 PM
Yes, that is exactly the information I'm trying to get. Thank you very much.

furbearingmammal
06-06-2011, 09:36 PM
Moved to proper forum. :)

CR6
06-06-2011, 11:37 PM
Thanks fur man! :)


Tapatalker!

alostpacket
06-14-2011, 03:29 AM
Depends on your phone, but contact info is stored in the contacts content provider. This is VERY, VERY different before 2.0 and after.

Before 2.0:
Contacts | Android Developers (http://developer.android.com/reference/android/provider/Contacts.html)

After and including 2.0:
ContactsContract | Android Developers (http://developer.android.com/reference/android/provider/ContactsContract.html)

The first thing you may want to read up on (if you dont already know) is how to access data from a ContentProvider
Content Providers | Android Developers (http://developer.android.com/guide/topics/providers/content-providers.html)

NOTE: the examples they use in the Android documentation for content providers show the OLD Contacts API (pre-eclair/2.0)