【发布时间】:2013-08-27 15:01:57
【问题描述】:
我正在尝试为另一个应用程序的活动创建快捷方式(这也是我的)。快捷方式正确启动了活动,但只收到了两个额外内容之一(或发送,我不知道)。请看下面的代码:
//Setting up the intent
Intent intent = new Intent();
intent.putExtra("num", 12);
intent.putExtra("name", "something");
intent.setComponent(new ComponentName
("com.myanother.app","com.myanother.app.MyActivity"));
还有其他活动:
Bundle extras = getIntent().getExtras();
if (extras != null) {
int num = extras.getInt("num"); //this worked
String name = extras.getString("name"); //this gets null
那么,怎么了?如果我犯了一些错误,请原谅我的英语。
【问题讨论】:
-
检查您是否正在发送具有相同键“名称”的任何其他数据或将此键更改为其他单词
-
我尝试更改密钥名称,但也没有用。并且没有其他数据具有相同的键。
标签: android android-intent android-widget