标签:
String name = shopList.get(position).getName(); //意图 Intent it = new Intent(); //bundle对象 Bundle类用作携带数据,它类似于Map,用于存放key-value名值对形式的值。 Bundle mBundle = new Bundle(); mBundle.putString("name", name); //存放数据 it.putExtras(mBundle); //跳转activity it.setClass(MainActivity.this, ShopInfoActivity.class); //意图开启 startActivity(it);
//声明变量 private TextView shopName;
init(); private void init(){ //初始化控件 shopName = (TextView) findViewById(R.id.tv_shop_name); //实现方法,获取MainActivity传过来的参数 shopName.setText(getData()); }
private String getData(){ Intent it = getIntent(); Bundle mBundle = it.getExtras(); String name = mBundle.getString("name"); return name; }
标签:
原文地址:http://www.cnblogs.com/superdo/p/5173091.html