Now I am doing an application using fragments.
So i care a fragment activity with four fragments fragment A,fragment B, fragment C, Fragment D.
By default Fragment A will be selected and on tab click I can switch to fragment B,C,D or A.
My problem is I want to check a condition in fragment A and depends on result switch to fragment B.Like.
Intent in=new Intent(src,destination);
startactivity(in)
I want to switch to other fragment without clicking tab button.Following is the code i used to add fragment.I want to check a condition depends on that condition fragment a,fragment b tab will selected
ActionBar bar = getSupportActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
ActionBar.Tab tab1 = bar.newTab();
ActionBar.Tab tab2 = bar.newTab();
tab1.setText("Fragment A");
tab2.setText("Fragment B");
tab1.setTabListener(new MyTabListener());
tab2.setTabListener(new MyTabListener());
bar.addTab(tab1);
bar.addTab(tab2);
please help me friends.
If by selecting a tab you can switch to a certain fragment e.g
tab1brings upFragment A, then all you need to do is select that tab. For example your currently viewingFragment Band need to check some condition which will determine whether you switch toFragment AorC