Hi Kristoffer,
Hope you were following the tutorial I've posted in the last response. I've
figured out a way to do your requirement. The idea is to clear all the tabs
which is loaded before in onClick of the button inside one of the view. You
can move that code into yout on_preference_change (or what ever you are
using). Anyway, I'm not sure this is the optimal way to do the same, but it
works!
Thanks
public class HelloTabActivity extends TabActivity {
int verified = 1;
TabHost mTabHst;
View view1,view2;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mTabHst = getTabHost();
view1 =
((LayoutInflater)getApplicationContext().getSystemService(getApplicationContext().LAYOUT_INFLATER_SERVICE)).inflate(R.layout.layout_one,(ViewGroup)
mTabHst.getChildAt(2));
view2 =
((LayoutInflater)getApplicationContext().getSystemService(getApplicationContext().LAYOUT_INFLATER_SERVICE)).inflate(R.layout.layout_two,(ViewGroup)
mTabHst.getChildAt(2));
view1.findViewById(R.id.button1).setOnClickListener(new
OnClickListener() {
@Override
public void onClick(View arg0) {
verified = 0;
setTabs();
}
});
setTabs();
mTabHst.setCurrentTab(0);
}
private void setTabs() {
Resources res = getResources();
mTabHst.clearAllTabs();
mTabHst.addTab(mTabHst.newTabSpec("tab_test1").setIndicator("One",res.getDrawable(R.drawable.one)).setContent(new
TabContentFactory() {
@Override
public View createTabContent(String tag) {
//int verified = pref.getInt("verified", 0);
if (verified == 1)
return view1;
else
return view2;
}
}));
}
}
--
Subin Sebastian
www.nintriva.com
http://in.linkedin.com/in/subinsebastien
https://plus.google.com/subin<https://plus.google.com/118262481642737404812>
--
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