0
nullim using Cursor cursor = getContentResolver() .query(contactUri,projection,null,null,null);獲取點擊聯繫人的數量。是否可以使用此查詢獲取電子郵件,電話號碼和姓名。與此同時? 我們可以這樣做嗎?如下所示?查詢以獲取電子郵件地址,聯繫人姓名和電話號碼的一行代碼
String[] projection = {Phone.NUMBER};
String[] projection1 = {Email.DATA};
String[] projection2 = {Contacts.DISPLAY_NAME};
Cursor cursor = getContentResolver().
query(contactUri, projection, null,projection1,projection2);
cursor.moveToFirst();
int column = cursor.getColumnIndex(Phone.NUMBER);
int column1 = cursor.getColumnIndex(Email.DATA);
int column2= cursor.getColumnIndex(Contacts.DISPLAY_NAME);
String number = cursor.getString(column);
String email1 = cursor.getString(column1);
String name1 = cursor.getString(column2)
這是可能的嗎?
現在是否正確?
String[] projection = {Phone.NUMBER, Email.ADDRESS, Contacts.DISPLAY_NAME};
Cursor cursor = getContentResolver().
query(contactUri, projection, null,null,null);
cursor.moveToFirst();
int column = cursor.getColumnIndex(Phone.NUMBER);
int column1 = cursor.getColumnIndex(Email.ADDRESS);
int column2= cursor.getColumnIndex(Contacts.DISPLAY_NAME);
String number = cursor.getString(column);
String email1 = cursor.getString(column1);
String name1 = cursor.getString(column2)
editText3 = (EditText) findViewById(R.id.editText3);
editText17 = (EditText) findViewById(R.id.editText17);
editText3.setText(number);
editText17.setText(email1);
只有電話號碼是越來越在文本框中 edittext3設置和edittext17都有手機號碼?我做錯了什麼? 謝謝
其餘部分將保持相同的吶? – Metalhead1247 2013-04-03 18:34:04
只有電話號碼在文本框中設置edittext3和edittext17都有手機號碼?我做錯了什麼?謝謝 – Metalhead1247 2013-04-03 18:39:05
即時通訊獲取姓名和電話號碼,但在電子郵件的地方再次號碼id: – Metalhead1247 2013-04-03 18:43:46