我先是在mainActivity中定义了一个用于做呈现的tabhost,里面的tab通过intent来加载用NormalListActivity实现的listview,现在需要在mainActivity中根据用户输入的list来放到NormalListActivity中的listview中显示出来,不知道该如何传递这些数据,求救于各位大虾。我在tabhost中加载listview的方法如下,这段代码没问题:
TabHost tabhost = getTabHost();
title = CreateTabTitle();
for(int i=0;i < title.length;i++){
LinearLayout view = (LinearLayout) getLayoutInflater().inflate(R.layout.tabwiget, null);
((TextView)view.findViewById(R.id.tv_title)).setText(title[i]);
tabhost.addTab(tabhost.newTabSpec(title[i]).setIndicator(view)
.setContent(new Intent(mainActivity.this, NormalListActivity.class)));
}
TabHost tabhost = getTabHost();
title = CreateTabTitle();
for(int i=0;i < title.length;i++){
LinearLayout view = (LinearLayout) getLayoutInflater().inflate(R.layout.tabwiget, null);
((TextView)view.findViewById(R.id.tv_title)).setText(title[i]);
tabhost.addTab(tabhost.newTabSpec(title[i]).setIndicator(view)
.setContent(new Intent(mainActivity.this, NormalListActivity.class)));
}
解决方案 »
- The hierachy of the type (ClassName) is inconsistant.
- android音乐播放器运行时出现Sorry!The application Menu02(process com.amaker.test)has stoppe
- android listview不运行getView
- github里面的android menudrawer控件导入存在大量错误,求解决
- 求开发android的语音聊天的思路
- eclipse+android 编译问题
- 恶劣网络环境,android客户端和服务器数据同步方案
- Android为什么我在非UI线程操作UI运行不报错
- i-Jetty发布应用偶尔能访问MP4文件,什么原因?
- 安卓高德地图开发
- android HttpPost
- Gallery怎么设置当前被选中的那张图片的背景色?
tabhost.addTab(tabhost.newTabSpec(title[i]).setIndicator(view)
.setContent(new Intent(mainActivity.this, NormalListActivity.class)));改为:
Intent tabIntent = new Intent(mainActivity.this, NormalListActivity.class);
Bundle bundle = new Bundle();
bundle.putString("list", list); //假设你的list是字符串类型
tabIntent.putExtras(bundle);tabhost.addTab(tabhost.newTabSpec(title[i]).setIndicator(view).setContent(tabIntent));
然后在NormalListActivity里面增加Intent intent = getIntent();
Bundle bundle = intent.getExtras();
String getList = bundle.getString("list");