BadParcelableException:获取所选联系人姓名时出现 ClassNotFoundException
我使用联系人选择器来获取特定联系人的姓名。对于 Eclair 和后来的我使用:
startActivityForResult(new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI), CONTACT_PICKER_RESULT);
在 onActivityResult()
中我只是这样做:
final String contactName = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
这工作正常,除了在 Motoblur 上,我在 Motoblur 上遇到此异常:
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)
是否有另一种方法来获取适用于 Motoblur 的名称出色地? Motoblur 有解决方法吗?
预先感谢,
乔纳斯
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
ContentResolver
效果很好。似乎Intent.EXTRA_SHORTCUT_NAME
无法在所有手机上可靠地工作(我也听说过有关它在 HTC 上无法完全工作的报告)。Using
ContentResolver
works fine. It seems likeIntent.EXTRA_SHORTCUT_NAME
doesn't work reliably on all phones (I've also heard reports about it not working fully on HTC).