我正在尝试在 android 中捕获 mms 事件-我有一个 ContentResolver,我将其设置如下:
final String[] projection = new String[] { "retr_st", "date", "_id", "ct_t" };
Uri uri = Uri.parse("content://mms-sms/conversations");
Cursor cursor = contentResolver.query(uri, projection, null, null,"_id DESC");
设置游标时,出现错误:FATAL EXCEPTION java.lang.NullPointerException。
这个奇怪的事情是这适用于我的旧版本的android,但不适用于galaxy s3。短信似乎也可以正常工作。有任何想法吗?提前致谢!
FATAL EXCEPTION: main
java.lang.NullPointerException
at android.os.Parcel.readException(Parcel.java:1431)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:188)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:366)
at android.content.ContentResolver.query(ContentResolver.java:372)
at android.content.ContentResolver.query(ContentResolver.java:315)
at com.onguardian.mobile.DataCollector.getMMS(DataCollector.java:116)
at com.onguardian.mobile.SentinelService.grabMMS(SentinelService.java:709)
at com.onguardian.mobile.SentinelService.access$3(SentinelService.java:700)
at com.onguardian.mobile.SentinelService$5.run(SentinelService.java:144)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4950)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
at dalvik.system.NativeStart.main(Native Method)