0

I have a small app, just user choose one contact in the contact list and its Mobile phone number will print to screen.

So, after a use click to one contact in list, it will return an URI object contain information about this user. And I put some query to process.

Here is my simple query:

    Cursor phoneCursor = getContentResolver().query(uri, new String[]{ContactsContract.CommonDataKinds.Phone.NUMBER}, 
                            ContactsContract.CommonDataKinds.Phone.TYPE+"="+ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE, 
                            null, null); //uri: URI Object return when user choose one contact
if (phoneCursor.moveToFirst()){
            String phoneNumber = phoneCursor.getString(phoneCursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
        }

But when I run to this code, LogCat show error:

1)DatabaseUtils.readExceptionFromParcel

2)Error at :

 ontactsContract.CommonDataKinds.Phone.TYPE+"="+ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE,

I don't think my query has "grammar mistake" because I have checked carefully and LogCat doesn't show error that.

Please help me solve this problem.

thanks :)

hqt
  • 29,632
  • 51
  • 171
  • 250

1 Answers1

0

You should see at line:

new String[]{ContactsContract.CommonDataKinds.Phone.NUMBER

When I debug, LogCat see that error first from this point. (this is a string constant and equal to "data1"