//使用Bundle传递数据参数
Intent intent=new Intent();
intent.setClass(MainActivity.this, TwoActivity.class);
Bundle bundle=new Bundle();
bundle.putString("name", "你好");
bundle.putString("pwd", “123”);
intent.putExtras(bundle);
startActivity(intent);
另一个activity取值:
Bundle bundle=this.getIntent().getExtras();
String strName=bundle.getString("name");
String strPwd=bundle.getString("pwd");
txtTitle.setText("欢迎:"+strName+" pwd:"+strPwd);
Intent intent=new Intent();
intent.setClass(MainActivity.this, TwoActivity.class);
Bundle bundle=new Bundle();
bundle.putString("name", "你好");
bundle.putString("pwd", “123”);
intent.putExtras(bundle);
startActivity(intent);
另一个activity取值:
Bundle bundle=this.getIntent().getExtras();
String strName=bundle.getString("name");
String strPwd=bundle.getString("pwd");
txtTitle.setText("欢迎:"+strName+" pwd:"+strPwd);
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货