How to fix reload WebView When Rotate App Screen

1 min


How to fix reload WebView When Rotate App Screen
How to fix reload WebView When Rotate App Screen

How to fix reload WebView When Rotate App Screen

Android – Preventing WebView reload on Rotate

This is 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 to turn off reload when rotate app screen?

How to fix reload WebView When Rotate App Screen

First open your Android Studio project and paste bellow 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?


Like it? Share with your friends!

Danushka Sanjeewa
Danushka Sanjeewa is a Software engineer with more than 5 years of experience in Android App Development, Web Development, Marketing, Graphic design, Video editing, and WordPress. And also Writer/Founder of TechEduTricks.com.

0 Comments

Your email address will not be published. Required fields are marked *