//获得联系人
mCs = getContentResolver().query(Contacts.Phones.CONTENT_URI, null, null, null, null);
startManagingCursor(mCs);
String[] from = new String[] {Contacts.Phones.NAME, Contacts.Phones.NUMBER };
int[] to = new int[] {android.R.id.text1, android.R.id.text2};
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
android.R.layout.simple_list_item_2, mCs, from, to);
setListAdapter(adapter);//删除
SimpleCursorAdapter sa = (SimpleCursorAdapter)getListAdapter();
Cursor cursor = sa.getCursor();
cursor.moveToPosition((int)rowId);
String name = cursor.getString(cursor.getColumnIndex(Contacts.Phones.NAME));
Log.i(TAG, name);
getContentResolver().delete(Contacts.People.CONTENT_URI,
Contacts.People.NAME + "=?", new String[] { name });基于列表的显示 。 网上这样的代码应该不少的啊。
mCs = getContentResolver().query(Contacts.Phones.CONTENT_URI, null, null, null, null);
startManagingCursor(mCs);
String[] from = new String[] {Contacts.Phones.NAME, Contacts.Phones.NUMBER };
int[] to = new int[] {android.R.id.text1, android.R.id.text2};
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
android.R.layout.simple_list_item_2, mCs, from, to);
setListAdapter(adapter);//删除
SimpleCursorAdapter sa = (SimpleCursorAdapter)getListAdapter();
Cursor cursor = sa.getCursor();
cursor.moveToPosition((int)rowId);
String name = cursor.getString(cursor.getColumnIndex(Contacts.Phones.NAME));
Log.i(TAG, name);
getContentResolver().delete(Contacts.People.CONTENT_URI,
Contacts.People.NAME + "=?", new String[] { name });基于列表的显示 。 网上这样的代码应该不少的啊。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货