I've done a lot of googling over the days and I haven't been able to get this problem solved. I'm writing an app and a widget in which I want the quick contact dialog displayed when the user clicks on an ImageView
or some other view element by calling QuickContact.showQuickContact()
. For some reason, every time I try on Eclair, I get the following error thrown:
01-02 17:51:28.869: ERROR/AndroidRuntime(657): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sx.favwidget/com.sx.favwidget.PopupActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.android.contacts.action.QUICK_CONTACT dat=content://com.android.contacts/contacts/lookup/0n4D29415739 flg=0x14200000 (has extras)
(I left out the rest of the logcat, but I can put it back if you guys need it)
When I try the exact same code on Froyo, it just works. I don't want to have my app targeted only for Froyo users - I'm targeting 2.1 as the minimum OS level. I've found some other people on Stack Overflow struggling with getting QuickContacts to display.
I could use a QuickContactBadge, and that does work on Eclair, but I'm not allowed a QuickContactBadge in an AppWidget, so I have do this instead. I dug through Android's source code and found the relevant XML files and code for creating the layout but I can't just easily compile it myself because it's a huge headache with all the private API calls.
Here is my code. It's simple.
grid.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
String name = ((TextView)v.findViewById(R.id.grid_item_label)).getText().toString();
Cursor sc = getContentResolver().query(Contacts.CONTENT_URI, new String[] {Contacts.LOOKUP_KEY, Contacts._ID}, Contacts.DISPLAY_NAME + "= ?", new String[] {name}, null);
sc.moveToFirst();
String lookup_key = sc.getString(sc.getColumnIndex(Contacts.LOOKUP_KEY));
Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, lookup_key);
QuickContact.showQuickContact(getApplicationContext(), v, uri, QuickContact.MODE_SMALL, null);
}
}
It's just so strange that it works on Froyo, not Eclair, but the API call has been there since Android 2.0. Can anyone help me here??
Thanks so much!!!