为什么内容uri在这种情况下不起作用

时间:2012-11-27 08:14:03

标签: android

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"

1 个答案:

答案 0 :(得分:0)

您应该使用content://contacts/people获取联系信息