写了一个TabActivity,想要在每个tab里面都用个ListView从数据库添加所要的数据。通过TabHost的实例化对象tabhost.setcontent(intent)方法连接ListView的Activity,但想通过intent传递个数据过去,用来辨别要显示哪些数据。
用了tabhost.setContent(intent.putExtras(cn.edu.nuc.lookTab.this.notSentBundle),但报错了。(notSentBundle是我创建的用来传数据的Bundle类对象)
求指点!!
用了tabhost.setContent(intent.putExtras(cn.edu.nuc.lookTab.this.notSentBundle),但报错了。(notSentBundle是我创建的用来传数据的Bundle类对象)
求指点!!
解决方案 »
- Android移动语音通信问题,求解答
- 各位大神求解,Android项目后提示@override错误怎么办。
- 我写的代码在2.3.5上可以运行,但是在安卓4.0.3不可以.求解
- anroid4.0 设置菜单settings如何删除条目屏幕锁定
- ndk r8开发C++程序问题
- android http 代理
- 画布刷新的问题
- 获取组合控件中的子控件???
- android usb 传输数据
- ni本地调用相关问题 win7 eclipse4.2 OpenCV-2.4.6-android-sdk-r2 ndk-r9
- 救命啊,这发生了什么?小白求指教
- Android开发从〇开始(5): 使用虚拟设备(x86)
我创建了三个Bundle的对象,要分别在三个Tab里面使用。但传到另一个Activity里面后,头一个notSentBundle传过去的数据是正确的,就是notSent。但后两个传过去的数据都是第三个draftboxBundle的数据draftbox。请问这是怎么回事啊?
notSentBundle = new Bundle();
notSentBundle.putString("text", "notSent");
sentBundle = new Bundle();
sentBundle.putString("text", "sent");
draftboxBundle = new Bundle();
draftboxBundle.putString("text", "draftbox");lookTabHost.addTab(lookTabHost.newTabSpec("One")
.setIndicator("", getResources().getDrawable(R.drawable.contact_photo))
.setContent(R.id.firstTabID)
.setContent(intent)
.setContent(intent.putExtras(cn.edu.nuc.lookTab.this.notSentBundle))
);
lookTabHost.addTab(lookTabHost.newTabSpec("Two")
.setIndicator("", getResources().getDrawable(R.drawable.contact_photo))
.setContent(R.id.secondTabID)
.setContent(intent)
.setContent(intent.putExtras(cn.edu.nuc.lookTab.this.sentBundle))
);
lookTabHost.addTab(lookTabHost.newTabSpec("Three")
.setIndicator("", getResources().getDrawable(R.drawable.contact_photo))
.setContent(R.id.thirdTabID)
.setContent(intent)
.setContent(intent.putExtras(cn.edu.nuc.lookTab.this.draftboxBundle))
);
我的一些例子:
TabHost tabhost = (TabHost) findViewById(android.R.id.tabhost);
tabhost.setup(this.getLocalActivityManager());
Intent intent1 = new Intent(this,Second.class);
Bundle bundle1 = new Bundle();
bundle1.putStringArray("string", strings1);
bundle1.putFloatArray("values", values1);
intent1.putExtra("bundle",bundle1);
Intent intent2 = new Intent(this,Second.class);
Bundle bundle2 = new Bundle();
bundle2.putStringArray("string", strings2);
bundle2.putFloatArray("values", values2);
intent2.putExtra("bundle",bundle2);
Intent intent3 = new Intent(this,Second.class);
Bundle bundle3 = new Bundle();
bundle3.putStringArray("string", strings3);
bundle3.putFloatArray("values", values3);
intent3.putExtra("bundle",bundle3);
tabhost.addTab(tabhost.newTabSpec("tab1").setIndicator("spec1").setContent(intent1));
tabhost.addTab(tabhost.newTabSpec("tab2").setIndicator("spec2").setContent(intent2));
tabhost.addTab(tabhost.newTabSpec("tab3").setIndicator("spec3").setContent(intent3));
另外还有个问题问一问哈、、我ListView的Activity里面,List是用的自己写的BaseAdapter的子类。里面写了三个Text和一个ToggleButton(请原谅我这个新手不会往这里面加图片……)。但现在只有ToggleButton有焦点,List没焦点。网上看资料说在布局文件里把ToggleButton设置为没焦点的就可以了。可是怎么设置了?或者还有其他办法?