Intentando evitar el cambio de orientación de la pantalla al salir de la actividad de inicio de sesión de Facebook en Android
Frecuentes
Visto 428 veces
1
To begin with, here is my AndroidManifest :
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id"/>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.ads.AdActivity"
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
<activity
android:name="com.facebook.LoginActivity"
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation">
</activity>
</application>
What I'm doing is this :
1. Show my MainActivity which contains a button to login with Facebook.
2. When the user clicks on the Facebook login button, the Facebook login activity is shown (instead of the MainActivity) asking the user for permissions among other things.
3. If the user decides to press the "back" key or the "cancel" button (so he can return to the MainActivity), the Facebook login dialog box disappears and then the status bar (I'm using the Samsung galaxy tab 10.1) goes into landscape mode for no reason and goes back to portrait mode just before showing the MainActivity.
I can't find a reason why it does that, it's really annoying. If anyone could help me with this, that would be great.
Gracias por adelantado
0 Respuestas
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas android facebook android-activity screen orientation or haz tu propia pregunta.
Have you tried to override onConfigurationChanged method in your activity?
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); }
- Harsh SingalYes, i did exactly that and it didn't change anything. - zlithgow
@zlithgow. Could you pls share me the solution, if you made this working? - Nilanchala Panigrahy