In android is it possible to open the phone contacts list using preferences
I am new in android development, Please help me to solve this, I want to know can I open the phone contacts list using preferences. Please tell me which preference I have to use for this I tried it with the 开发者_如何学编程list preferences but not be able to solve this.Please suggest me what is best approach to solve this.
If I understand you correctly, you want to add a preference to pick a contact from the phone contact list. There is no direct support for it, i.e. there is no ContactPreference
. You could create your own preference by extending DialogPreference
. Calling the standard PICK_CONTACT
action may help.
hmm yes,
this is from the sample api docs,
public class List3 extends ListActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get a cursor with all phones
Cursor c = getContentResolver().query(Phones.CONTENT_URI,
null, null, null, null);
startManagingCursor(c);
// Map Cursor columns to views defined in
simple_list_item_2.xml
ListAdapter adapter = new SimpleCursorAdapter(this,
android.R.layout.simple_list_item_2, c,
new String[] { Phones.NAME, Phones.NUMBER },
new int[] { android.R.id.text1,
android.R.id.text2 });
setListAdapter(adapter);
}
}
精彩评论