I'm using default Activity in Android where you choose "Scrollable tabs + Swipe" as Navigation type. How can I determine which tab is currently showing, after sliding?
I tried it like this in class DummySectionFragment
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_starting_dummy,
container, false);
TextView dummyTextView = (TextView) rootView
.findViewById(R.id.section_label);
dummyTextView.setText(Integer.toString(getArguments().getInt(
ARG_SECTION_NUMBER)));
switch(getArguments().getInt(ARG_SECTION_NUMBER))
{
case 1: // do something
....
}
but it's not working, becuase this method onCreateView
is not being called always after sliding. I guess there is some easy way to do it, but I just can't find it. (also, it would be very good if it would be available for API 8)