nullim 使用 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都有手机号码?我做错了什么?谢谢你