Need to pick contact from a dialog preference

Posted by MLW on Stack Overflow See other posts from Stack Overflow or by MLW
Published on 2011-01-03T16:49:49Z Indexed on 2011/01/03 16:54 UTC
Read the original article Hit count: 248

Filed under:

I would like to add a preference setting that uses an ACTION_PICK intent. My goal is to acquire the phone number of a contact in my phone by using a preference. Is this possible?

I can run this code from my activity but I discovered I cannot run it from a class that extends DialogPreference.

Intent intentContact = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); startActivityForResult(intentContact, PICK_CONTACT);

Or is there a way to start a new activity from a preference? Then that activity could execute the above two lines of code?

© Stack Overflow or respective owner

Related posts about android