Hello,
I want to get all view in tabhost.
Now,I have a tabhost with 4 tabs.
I just could get tab1's content, but could not get tab2~4's content.
example:
private TabHost tabHost;
private void initControl(){
tabHost =(TabHost) findViewById( R.id.tabhost);
tabHost.setup(this.getLocalActivityManager());
Intent intent = new Intent().setClass(this, aa.class);
tabHost.addTab(tabHost.newTabSpec("aa")
.setIndicator("aa")
.setContent(intent)
);
intent = new Intent().setClass(this, bb.class);
tabHost.addTab(tabHost.newTabSpec("bb")
.setIndicator("bb")
.setContent(intent)
);
intent = new Intent().setClass(this, cc.class);
tabHost.addTab(tabHost.newTabSpec("cc")
.setIndicator("cc")
.setContent(intent)
);
intent = new Intent().setClass(this, dd.class);
tabHost.addTab(tabHost.newTabSpec("dd")
.setIndicator("dd")
.setContent(intent)
);
tabHost.setCurrentTab(0);
tabHost.setCurrentTab(1);
tabHost.setCurrentTab(2);
tabHost.setCurrentTab(3);
}
private void queryEvent(){
View view1 = tabHost.getTabContentView().getChildAt(0) //view1 isn't
null
View view2 = tabHost.getTabContentView().getChildAt(1) //view2 isn't
null
View view3 = tabHost.getTabContentView().getChildAt(2) //view3 isn't
null
View view4 = tabHost.getTabContentView().getChildAt(3) //view4 isn't
null
LinearLayout linearLayout_aa =
(LinearLayout)view1.findViewById(R.id.linearLayout_aa) //
linearLayout_aa isn't null
LinearLayout linearLayout_bb =
(LinearLayout)view2.findViewById(R.id.linearLayout_bb) //
linearLayout_bb is null
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en