I'm trying to send the user to the native contacts application so that they can edit the contact in there, it's working fine in V3.0+ But in a device with 2.3.3 it's giving me an exception, can someone explain me what might be happening?
The code is the following:
if(contactLookupKey != null) {
Intent intent = new Intent(Intent.ACTION_EDIT);
Uri lookupUri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_VCARD_URI, contactLookupKey);
Uri res = ContactsContract.Contacts.lookupContact(getContentResolver(), lookupUri);
intent.setData(res);
this.isEditing = true;
startActivity(intent);
}
And i'm getting the following Exception:
01-31 15:51:50.544: E/AndroidRuntime(27867): java.lang.IllegalArgumentException: Invalid column _id
01-31 15:51:50.544: E/AndroidRuntime(27867): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:144)
01-31 15:51:50.544: E/AndroidRuntime(27867): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:114)
01-31 15:51:50.544: E/AndroidRuntime(27867): at android.content.ContentProviderProxy.bulkQueryInternal(ContentProviderNative.java:330)
01-31 15:51:50.544: E/AndroidRuntime(27867): at android.content.ContentProviderProxy.query(ContentProviderNative.java:366)
01-31 15:51:50.544: E/AndroidRuntime(27867): at android.content.ContentResolver.query(ContentResolver.java:268)
In the manifest i have:
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.contactive"
android:installLocation="auto"
android:versionCode="17"
android:versionName="0.8.5" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
Thanks a lot!