First of all I\'m new to Android - this question could seem stupid :)
I\'ve created an main Activity that contains a ViewPager. The ViewPager is linked to
so if the onSaveInstance was Called
you can declare a global variable for your
int pos=0;
after onSaveInstance() gets called, method below is called:
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
pos=savedInstanceState.getInt("tab", 0);
}
so in your onCreate() function replace the condition from this:
if (savedInstanceState != null) {
actionBar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0));
}
to this:
if(pos>0){
actionBar.setSelectedNavigationItem(pos);
}