2

I use the Contact picker to get the name of a specific contact. For Eclair and later I use:

startActivityForResult(new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI), CONTACT_PICKER_RESULT);

and in onActivityResult() I just do:

final String contactName = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);

This works fine except on Motoblur, where I get this exception:

android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.motorola.blur.provider.contacts.IdentityModel
    at android.os.Parcel.readParcelable(Parcel.java:1883)
    at android.os.Parcel.readParcelableArray(Parcel.java:1922)
    at android.os.Parcel.readValue(Parcel.java:1825)
    at android.os.Parcel.readMapInternal(Parcel.java:2008)
    at android.os.Bundle.unparcel(Bundle.java:208)
    at android.os.Bundle.getString(Bundle.java:1034)
    at android.content.Intent.getStringExtra(Intent.java:3399)

Is there another way of getting the name which would work on Motoblur as well? Is there a workaround for Motoblur?

Thanks in advance,
Jonas

jonasb
  • 1,847
  • 1
  • 17
  • 15

1 Answers1

2

Using ContentResolver works fine. It seems like Intent.EXTRA_SHORTCUT_NAME doesn't work reliably on all phones (I've also heard reports about it not working fully on HTC).

jonasb
  • 1,847
  • 1
  • 17
  • 15