12-16 16:17:32.972 20461-20461/***.****.******.deBUG E/AndroIDRuntime: FATAL EXCEPTION: mainProcess: ***.****.******.deBUG,PID: 20461java.lang.IllegalArgumentException: Bad value in PersistableBundle key=shortcutID value=***.****.******.common.cta.CtaAccountSectionModel@1fb70dcat androID.os.PersistableBundle.<init>(PersistableBundle.java:124)at androID.os.PersistableBundle.<init>(PersistableBundle.java:98)at androID.content.pm.ShortcutInfo.fixUpIntentExtras(ShortcutInfo.java:267)at androID.content.pm.ShortcutInfo.<init>(ShortcutInfo.java:245) at androID.content.pm.ShortcutInfo.<init>(ShortcutInfo.java) at androID.content.pm.ShortcutInfo$Builder.build(ShortcutInfo.java:1027) at ****.******.***.ShortcutHelper.createShortcut(ShortcutHelper.java:79) at ****.******.***.ShortcutHelper.refreshShortcuts(ShortcutHelper.java:87) at ****.******.***.****.******.***.refreshShortcuts(Application.java:93) at ****.******.***.refreshShortcuts(SettingActivity.java:247) at ****.******.***.storeShortcuts(SettingActivity.java:242) at c****.******.***.access0(SettingActivity.java:56) at ****.******.***.SettingActivity.onClick(SettingActivity.java:233) at androID.vIEw.VIEw.performClick(VIEw.java:5637) at androID.vIEw.VIEw$PerformClick.run(VIEw.java:22429) at androID.os.Handler.handleCallback(Handler.java:751) at androID.os.Handler.dispatchMessage(Handler.java:95) at androID.os.Looper.loop(Looper.java:154) at androID.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Native Method) at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:776)
CtaAccountSectionModel.class
public class CtaAccountSectionModel extends CtaModel implements Serializable {}
CtaModel.class
@JsonTypeInfo( use = JsonTypeInfo.ID.name,include = JsonTypeInfo.As.PROPERTY,defaultImpl = CtaDefaultModel.class,property = "action",visible = true) @JsonSubTypes({ @JsonSubTypes.Type(value = CtaProductPageModel.class,name = CtaActionModel.ACTION_PRODUCT_PAGE))})public class CtaModel implements Serializable { private String action; private String name; public String getAction() { return action; } public voID setAction(String action) { this.action = action; } public String getname() { return name; } public voID setname(String name) { this.name = name; }}
这里的代码我创建了intent:
public ShortcutBackStackBuilder getHistoryWithBackStack(String section) { Intent intent = IntentAppFactory.createMainActivityFromShortcut(mContext).putExtra(IntentExtraConstants.EXTRA_SHORTCUT_ID,new CtaAccountSectionModel(section)) .setAction(Intent.ACTION_MAIN); mIntentlinkedList.add(intent); return this;}
任何人都知道是否不允许在牛轧糖快捷方式中传递Serializable?
解决方法 PersistableBundle类使用以下方法检查其内容:public static boolean isValIDType(Object value) { return (value instanceof Integer) || (value instanceof Long) || (value instanceof Double) || (value instanceof String) || (value instanceof int[]) || (value instanceof long[]) || (value instanceof double[]) || (value instanceof String[]) || (value instanceof PersistableBundle) || (value == null) || (value instanceof Boolean) || (value instanceof boolean[]);}
所以不幸的是,只有这些类可以捆绑到Intent for Shortcuts中.
来源:PersistableBundle.java
总结以上是内存溢出为你收集整理的android – Nougat版本的快捷方式全部内容,希望文章能够帮你解决android – Nougat版本的快捷方式所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)