Uri sare_sms = Uri.parse("content://contacts/");
Cursor c = getContentResolver().query(sare_sms, null, null, null, null);
TextView txt = ( TextView ) findViewById (R.id.txt);
txt.setText( new Integer(c.getColumnCount()).toString());
此代码无效
但是
Uri sare_sms = Uri.parse("content://sms/inbox/");
Cursor c = getContentResolver().query(sare_sms, null, null, null, null);
TextView txt = ( TextView ) findViewById (R.id.txt);
txt.setText( new Integer(c.getColumnCount()).toString());
这正是为什么工作正常?
&安培;我已经包括
uses-permission android:name="android.permission.READ_SMS"
uses-permission android:name="android.permission.READ_CONTACTS"
答案 0 :(得分:0)
您应该使用content://contacts/people
获取联系信息