快捷意图演员重启后失去了什么? [英] Shortcut intent extras lost after restart?

查看:197
本文介绍了快捷意图演员重启后失去了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序收听广播android.intent.action.CREATE_SHORTCUT,在我的code我创建一个快捷方式,其中包括多余的这样一个字符串:

My application listens to the android.intent.action.CREATE_SHORTCUT broadcast, in my code I am creating a shortcut which includes a String extra like this:

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,我查了日志和调试)。这是正常的行为呢?我做错了?我需要临时演员传递给活动。

The shortcut works BUT the extras are lost on each phone reboot (they return null, I checked logs and debugged). Is this normal behaviour? I am doing it wrong? I need to pass the extras to the activity.

推荐答案

我回答我的问题。我把一个String数组的意图额外费用。主屏幕上也不会坚持字符串数组!

I am answering my own question. I was placing a String array into the intent extra. Home screen will not persist string arrays!

我找到了答案为:
<一href=\"http://groups.google.com/group/android-developers/browse_thread/thread/7f2ce458bd5d112f/189e2b7b2b2532d7\" rel=\"nofollow\">http://groups.google.com/group/android-developers/browse_thread/thread/7f2ce458bd5d112f/189e2b7b2b2532d7

这篇关于快捷意图演员重启后失去了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆