gpt4 book ai didi

java - 非法参数异常 readExceptionFromParcel

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:29:40 32 4
gpt4 key购买 nike

我从我的一个用户那里得到了这个错误,我不知道如何修复它...

java.lang.IllegalArgumentException异常DatabaseUtils.readExceptionFromParcel()

java.lang.IllegalArgumentException: URI: content://com.android.contacts/phone_lookup/, calling user: com.piroja.contactpicker, calling package:com.piroja.contactpicker at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:144)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:114)
at android.content.ContentProviderProxy.bulkQueryInternal(ContentProviderNative.java:330)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:366)
at android.content.ContentResolver.query(ContentResolver.java:245)
at com.piroja.contactpicker.ContactPicker.contactExists(ContactPicker.java:257)
at com.piroja.contactpicker.ContactPicker$6$1.onClick(ContactPicker.java:138)
at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:161)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
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:871)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
at dalvik.system.NativeStart.main(Native Method)

这是我正在调用的 contactExists 函数(我认为)导致强制关闭:

public boolean contactExists(Context context, String number) {
try {
Uri lookupUri = Uri.withAppendedPath(Phone.CONTENT_FILTER_URI, Uri
.encode(number));
String[] mPhoneNumberProjection = { Phone._ID, Phone.NUMBER,
Phone.DISPLAY_NAME };
Cursor cur = context.getContentResolver().query(lookupUri,
mPhoneNumberProjection, null, null, null);
try {
if (cur.moveToFirst()) {
return true;
}
} finally {
if (cur != null)
cur.close();
}
} catch (IllegalArgumentException iae) {
return false;
}
return false;
}

我也曾尝试将 Phone.CONTENT_FILTER_URI 更改为 PhoneLookup.CONTENT_FILTER_URI 但它没有改变任何东西......有人知道吗?

最佳答案

电话查询 URI 有问题。从异常文本来看,它似乎缺少电话号码。您确定数字不为空且不为空吗?

关于java - 非法参数异常 readExceptionFromParcel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6349566/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com