android studio refresh webview on rotate code example
Example: how to fix webview reload
STEP1:
===============================================================================
if (savedInstanceState == null)
{
web.loadUrl(webURL);
}
STEP2:
===============================================================================
@Override
protected void onSaveInstanceState(Bundle outState )
{
super.onSaveInstanceState(outState);
web.saveState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState)
{
super.onRestoreInstanceState(savedInstanceState);
web.restoreState(savedInstanceState);
}
STEP3:
===============================================================================
Note: Please also add in your AndroidManifest.xml in your Activity
android:configChanges="orientation|screenSize"
Thanks