重启后快捷方式意图附加项丢失?

3

我的应用程序监听android.intent.action.CREATE_SHORTCUT广播,在我的代码中,我创建了一个包含String extra的快捷方式,如下所示:

Intent shortcutIntent = new Intent(Intent.ACTION_VIEW);
shortcutIntent.setClassName("com.some.name","com.some.name.Activity");
shortcutIntent.putExtra("stringid", "some string value");
ShortcutIconResource iconResource = Intent.ShortcutIconResource.fromContext(ShortcutActivity.this,iconIdentifier);

Intent intent = new Intent();

intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, channelName);
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource);
setResult(RESULT_OK, intent);

这个快捷方式可以使用,但每次手机重启后都会丢失额外的内容(它们会返回 null,我已经检查了日志并调试过)。这是正常行为吗?我做错了吗?我需要传递额外的内容给活动。


1
好的,我来回答自己的问题。我将一个字符串数组放入了意图额外信息中。主屏幕不会保留字符串数组!我在这里找到了答案:http://groups.google.com/group/android-developers/browse_thread/thread/7f2ce458bd5d112f/189e2b7b2b2532d7 - Daniel Novak
可以,但我必须等待8个小时才能回答自己的问题。 - Daniel Novak
1个回答

1

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接