我正在尝试使用此查询来读取 SIM 卡上的联系人。
cur = managedQuery(Uri.parse("content://icc/adn")
,null
,null
,null
,null
);
该应用程序具有 READ_CONTACTS 和 WRITE_CONTACTS 权限。然而,查询返回异常。
java.lang.NullPointerException
at android.os.Parcel.readException(Parcel.java:1224)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:160)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:114)
at android.content.ContentProviderProxy.bulkQuery(ContentProviderNative.java:369)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:388)
at android.content.ContentResolver.query(ContentResolver.java:202)
at android.app.Activity.managedQuery(Activity.java:1502)
at com.example.delirious.delirio.onCreate(delirio.java:38)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2544)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2621)
at android.app.ActivityThread.access$2200(ActivityThread.java:126)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1932)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4595)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
怎么了?