I'm trying to make a list of a specific contacts available phone
numbers. Here's what I have:
private OnItemClickListener mItemClickListener = new
OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v, int position,
long id) {
Uri contactUri = ContentUris.withAppendedId
(Contacts.People.CONTENT_URI, id);
Uri methodsUri = Uri.withAppendedPath(contactUri,
Contacts.People.ContactMethods.CONTENT_DIRECTORY);
Cursor c = managedQuery(methodsUri,
null,
Contacts.ContactMethodsColumns.KIND + "=" +
Contacts.KIND_PHONE,
null,
Contacts.ContactMethods.DEFAULT_SORT_ORDER);
String[] from = new String[] { Contacts.ContactMethods.TYPE};
int[] to = new int[] { android.R.id.text1 };
ListAdapter adapter = new SimpleCursorAdapter(
Activity.this,
android.R.layout.simple_list_item_1,
c,
from,
to );
new AlertDialog.Builder(Activity.this)
.setIcon(android.R.drawable.ic_dialog_dialer)
.setTitle("Choose Number")
.setAdapter(adapter, new
DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int
which) {
// Do stuff...
}})
.show();
}
};
Any help? Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---