1: //话说页面的跳转一定要注意:manifest <慎之……慎之>
Intent intent = new Intent(main.this, index.class);
/* 通过Bundle对象存储需要传递的数据 */ 此方法同样支持动态添加组件(不用XML)的页面跳转,当然:manifest <慎之……慎之>必须申明的
Bundlebundle = new Bundle();
/*字符、字符串、布尔、字节数组、浮点数等等,都可以传*/
bundle.putString("Name","gql");
bundle.putBoolean("pass",true);
/*把bundle对象assign给Intent*/
intent.putExtras(bundle);
startActivity(intent);
得到传递的数据
this.getIntent().getStringExtra("name");//"方法直接从Intent中获取数据。
/*获取Intent中的Bundle对象*/
Bundle bundle = this.getIntent().getExtras();
/*获取Bundle中的数据,注意类型和key*/
String name =bundle.getString("Name");
boolean pass =bundle.getBoolean("pass");
联系客服