I'm making my own browser and I need help. I'm trying to save the State of it. I've tried the following things, but not the solution I'm looking for.
I've tried this:
<activity android:name=".About"
android:configChanges="orientation|keyboard|screenSize" />
but the problem is that the toolbar is not resized, so the title is to small and toolbar height is smallest (if I start in landscape and rotate to portrait) and the title is to big and the heigh bigger (if I start in portrait and rotate to landscape).
The other things I've tried are
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.blah);
if (savedInstanceState != null)
((WebView)findViewById(R.id.webview)).restoreState(savedInstanceState.getBundle("webViewState");
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
Bundle bundle = new Bundle();
webView.saveState(bundle);
outState.putBundle("webViewState", bundle);
}
but WebView is not saved correctly.
What can I do to save webview State when rotating and without having problems with toolbar size?
Maybe it's better if I handle config changes and try to resize toolbar and text?