@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt("url_type", urlType.getCode()); // Save the state of the WebView mainWebView.saveState(outState); }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setRetainInstance(true); context = getActivity(); init(); // Restore the state of the WebView if (savedInstanceState != null) { mainWebView.restoreState(savedInstanceState); urlType = URLTYPE.getByCode(savedInstanceState.getInt("url_type")); } }