I do not have my IDE open at the moment, so syntax corrections might be needed:
@Override
protected void onSaveInstanceState(Bundle bundle) {
super.onSaveInstanceState(bundle);
bundle.putInt("currentItem", pager.getCurrentItem());
}
public void onCreate(Bundle savedInstanceState) {
...
if (savedInstanceState != null) {
pager.setCurrentItem(savedInstanceState.getInt("currentItem", 0));
}
}