我无法使用可序列化对象创建快捷方式作为intent extra。如何使用自定义对象创建快捷方式?
private void addShortcut(Intent intent, String vehicleNumber) {
Intent addIntent = new Intent();
addIntent
.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intent);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, vehicleNumber);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
Intent.ShortcutIconResource.fromContext(getContext(),
R.mipmap.ic_launcher));
addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
addIntent.putExtra("duplicate", false);
getContext().sendBroadcast(addIntent);
}