页面1
Intent intent = new Intent(MainActivity.this,TwoActivity.class);
intent.putExtra("showdata","今天天气很好");
startActivity(intent);
页面2
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.two_activity);
Intent intent = getIntent();
//获取参数
String showdata = intent.getStringExtra("showdata");
}
网友评论