您可以通过两种方式发送数据。目前,这就是您发送的方式。而且没有错。
//Create the bundleBundle bundle = new Bundle();//Add your data from getFactualResults method to bundlebundle.putString("VENUE_NAME", venueName);//Add the bundle to the intenti.putExtras(bundle);startActivity(i);但是,在您的代码(第二个Activity)中,您
key将Bundle称为,
MainActivity.VENUE_NAME但代码中没有任何内容表明您有一个类,该类返回的值是
key与Bundle一起发送的实际名称。将第二个活动中的代码更改为此:
Bundle bundle = getIntent().getExtras();//Extract the data…String venName = bundle.getString("VENUE_NAME");//Create the text viewTextView textView = new TextView(this);textView.setTextSize(40);textView.setText(venName);您可以使用它在第二个活动中签入捆绑包中是否包含密钥,并且您会知道
key捆绑包中不存在密钥。但是,上面的更正将使其为您工作。
if (bundle.containsKey(MainActivity.VENUE_NAME)) { ....}


