Reputation: 399
I have 3 tabs in the action bar. My TabListener class implements the ActionBar.TabListener to create the new TabFragment.
In the TabFragment Class (which extends Fragment), in the method "OnCreateView" I inflate a costum View.
The point is that I want to use the same View for each tab just changing a word. The View just write "this is the tab X" in the center of the screen but i want the X change depending of which tab is selected. I think there is two options to do what I want but I don't find how to do either of them.
Just to say that there is only one activity on the application. Thank you for the help!
Upvotes: 0
Views: 252
Reputation: 2236
make a static variable
public static int tabNo;
// OR
public static String tabName;
On selection of tab refer this static variable and change its name/no
and in your fragement or in activity change text of textView
textView.setText("This is tab :"+tabName");
Upvotes: 1