我正在尝试创建一个快捷方式来启动另一个应用程序的活动(也是我的应用程序)。该快捷方式可以正确地启动活动,但只收到了两个extras中的一个(或发送了一个,我不知道)。请参见以下代码:
//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
那么,出了什么问题?如果我的英语有误,对不起。