java – IllegalArgumentException readExceptionFromParcel

I got this error from one of my users. I don't know how to solve it

java. Lang.illegalargumentexception exception 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)

This is the contactexists function I'm calling (I think) that causes a forced shutdown:

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);
            try {
                if (cur.moveToFirst()) {
                    return true;
                }
            } finally {
                if (cur != null)
                    cur.close();
            }
        } catch (IllegalArgumentException iae) {
            return false;
        }
        return false;
    }

I also tried to put phone CONTENT_ FILTER_ Change the URI to phonelookup CONTENT_ FILTER_ URI, but it doesn't change anything... Does anyone have a clue?

Solution

There is a problem with the telephone query URI It appears from the exception text that it is missing a phone number Are you sure the number is not empty, not empty?

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>