在我的小型Android应用程序中,我创建了一个服务(Service)来接收来自Web服务器的一些字符串,并且我想将该字符串传递给我的活动(Activity),并在TextView中显示它。
我尝试了这个代码:
但它总是强制关闭应用程序。
请有人帮忙,因为我已经浪费了一周的时间。
提前致谢。
我尝试了这个代码:
Intent intent = new Intent(this, SecondActivity.class);
Bundle b = new Bundle();
b.putString("key", ITEM);
intent.putExtras(b);
startActivity(intent);
// 在 Activity 中
Bundle b = this.getIntent().getExtras();
String i = b.getString("key");
但它总是强制关闭应用程序。
请有人帮忙,因为我已经浪费了一周的时间。
提前致谢。