I am currently having a problem accessing a Fragment ID and Fragment Tag. I am currently implementing a Fragment in a TabHost and ViewPager, the new tab is added like this:
mTabsAdapter.addTab(bar.newTab().setText("Tab0"),
Tab0.class, null);
And the addTab method is the following:
public void addTab(ActionBar.Tab tab, Class<?> clss, Bundle args) {
TabInfo info = new TabInfo(clss, args);
tab.setTag(info);
tab.setTabListener(this);
mTabs.add(info);
mActionBar.addTab(tab);
notifyDataSetChanged();
}
I am currently having 2 tabs and 2 fragments opened in my activity: Tab0.class and Tab1.class. I want the fragment Id or Tag of Fragment Tab1 so that I can pass a value to it using callback method. Would you please be so kind to help me out with this ?
I have tried the following without luck:
public String addTab(ActionBar.Tab tab, Class<?> clss, Bundle args) {
TabInfo info = new TabInfo(clss, args);
tab.setTag(info);
tab.setTabListener(this);
mTabs.add(info);
mActionBar.addTab(tab);
notifyDataSetChanged();
return tab.getTag().toString();
}
and then later I called out the return String as the Fragment tag but it's always null. Could you please help me out ??????? What should I do to access Tab1 Fragment in the background. Thank you so much for your kind help :( !!