- 问题如下:
- TabSpec atSpec=tabHost.newTabSpec(AT_TAB).setIndicator(AT_TAB).setContent(new Intent(this,AtActivity.class));
- 这样的话,可以切换界面,但是无法传递参数。
- 于是将上面的程序改成这样
- Intent tabIntent = new Intent(本Activity.this, 目标Activity.class);
- Bundle bundle = new Bundle();
- bundle.putString("list", list); //假设你的list是字符串类型
- tabIntent.putExtras(bundle);
- tabhost.addTab(tabhost.newTabSpec(AT_TAB).setIndicator(AT_TAB).setContent(tabIntent));
- 在目标activity中加入获取传过来的参数
- Intent intent = getIntent();
- Bundle bundle = intent.getExtras();
- String getList = bundle.getString("list");
- 这样就完成了参数的传递
转载于:https://blog.51cto.com/591819849/1098494