I did this in my app:
-
OnCreate:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ...
-
Instances:
@Override protected void onSaveInstanceState(Bundle outState){ super.onSaveInstanceState(outState);//Salva Activity siteWebView.saveState(outState);//Salva WebView } @Override protected void onRestoreInstanceState(Bundle savedInstanceState){ super.onRestoreInstanceState(savedInstanceState);//Restaura o Activity siteWebView.restoreState(savedInstanceState);//Restaura o WebView }
And in the manifest I used:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="br.com.foo.bar">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>