How to fix reload WebView When Rotate App Screen?
Android – Preventing WebView reload on Rotate
This is a common problem you all have. When you rotate your app screen you will see your app web page reloads. Today I am going to show you How to fix it. How do turn off reload when rotating the app screen?
How to fix reload WebView When Rotate App Screen
First, open your Android Studio project and paste the below code in your AndroidManifest.xml > MainActivity.
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
Here is the sample full code (AndroidManifest.xml)
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.techedutricks.techedutricks"> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/Theme.TechEduTricks"> <activity android:name=".MainActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:hardwareAccelerated="true" > </activity> <activity android:name=".WelcomeScreen"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
Read also: How to Add Swipe Down Refresh in Android WebView?