Facebook login window closes when the screen rotates

I have embedded facebook in my application.

The login process is working correctly. When I click on the facebook image, it opens the facebook login window.

enter image description here

But when I rotate the emulator, it closes the login window.

enter image description here

Any solution.

+4
source share
3 answers

Add this to the manifest file for your activity

android:configChanges="keyboardHidden|screenSize|orientation"
+3
source

The approach I took was to prevent the OS from restarting your activity after changing the layout configuration. To do this, add this line to the actions you want to prevent restarting in the manifest file:

<activity
 android:configChanges="orientation|keyboard"
 ...
 >

, , , , XML. onConfigurationChanged() Activity:

@Override
public void onConfigurationChanged(Configuration newConfig)
{
    //Handle config changes here, paying attention to
    //the newConfig.orientation value
    super.onConfigurationChanged(newConfig);
}
+2

- , :

  • , savedInstanceState. onSaveInstanceState onCreate.

  • You can block activity in one orientation by adding android:screenOrientation="portrait"(or "landscape") to in your manifest.

  • You can tell the system that you are going to process screen changes for yourself by specifying android:configChanges="screenOrientation" in the tag. This way, the activity will not be recreated, but instead will receive a callback (which you can ignore, since it is not useful to you).

0
source

Source: https://habr.com/ru/post/1529990/


All Articles