Question

I have a WebView application, when i change the screen orientation of application it reloads itself.

I am using

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.myapp34"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="7"
        android:targetSdkVersion="19"
        />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>


    <application
        android:allowBackup="true"
        android:icon="@drawable/icon"
        android:label="@string/app_name0"
        android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen" >
        <activity
            android:name="com.myapp34.MainActivity"
            android:configChanges="orientation|screenSize"
            android:theme="@style/AppBaseTheme" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.myapp34.AboutUs"
            android:label="@string/title_activity_about_us" >
                <action android:name="android.intent.action.SEND" />
        </activity>
    </application>

</manifest>

I do not want it to reload again. I want that it continues showing normally when I change screen orientation.

Was it helpful?

Solution 5

The problem was on our main activity java and removed

@Override
public void onConfigurationChanged(Configuration newConfig) {
    setContentView(R.layout.activity_main);
    }

Also added

  android:configChanges="orientation|keyboardHidden|keyboard"

to manifest.xml

OTHER TIPS

use

android:screenOrientation="portrait"

You can use android:configChanges=”orientation|screenSize|uiMode" or in case you don't want to react to changes in screen orientation, you should add android:screenOrientation=”portrait”

Add "keyboardhidden" to android:configchanges and you try delete "screensize"

Set your screen orientation. This problem mainly due to the screen orientations... Update your manifest file as

        android:screenOrientation="portrait" 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top