Skip to content Skip to sidebar Skip to footer

Facebook Login Window Close When Screen Rotates

I have implemented facebook into my application. Login process is working properly. When I click on facebook image then it opens facebook login window. But When I rotate the emula

Solution 1:

Add this in manifest file for your Activity

android:configChanges="keyboardHidden|screenSize|orientation"

Solution 2:

The approach I took was to not allow the OS to restart your activity after the layout configuration change. To accomplish this, add this line within activities that you want to prevent from restarting in your manifest file:

<activityandroid:configChanges="orientation|keyboard"...
 >

Optionally, you can handle the configuration change in code in case there are some layout changes you want to make manually, such as reloading a new view from XML. This is done by overwriting the onConfigurationChanged() method in your Activity class:

@OverridepublicvoidonConfigurationChanged(Configuration newConfig)
{
    //Handle config changes here, paying attention to//the newConfig.orientation valuesuper.onConfigurationChanged(newConfig);
}

Solution 3:

Problem may be because of screen orientation configuration change, you can try one of following solutions:

  1. As some of the answers suggested, you could distinguish the cases of your activity being created for the first time and being restored from savedInstanceState. This is done by overriding onSaveInstanceState and checking the parameter of onCreate.

  2. You could lock the activity in one orientation by adding android:screenOrientation="portrait" (or "landscape") to in your manifest.

  3. You could tell the system that you meant to handle screen changes for yourself by specifying android:configChanges="screenOrientation" in the tag. This way the activity will not be recreated, but will receive a callback instead (which you can ignore as it's not useful for you).

Post a Comment for "Facebook Login Window Close When Screen Rotates"