locked
configurationChanged not getting fired in Android RRS feed

  • Question

  • User376415 posted

    This is my AndroidManifest.xml

    When the fragment/popUp is launched from Activity, and when I charge the device(Scanner Android Device) with the popUp open, then this attached screen comes up by default.

    The activity and fragment are getting recreated. I suspect that the configuration must be changed. However OnConfigurationChanged is not getting fired in my activity. I tried having this overridden in the baseactivity as well, but it didn't help.

    [Activity(Label = "@string/app_name", Theme = "@style/AppTheme", MainLauncher = true)] public partial class LoginActivity : BaseActivity { // other code public override void OnConfigurationChanged(Configuration newConfig) { base.OnConfigurationChanged(newConfig); // To handle attaching Scanner(or Keyboard) at runtime withOUT restarting activity }
    }

    OnConfigurationChanged is not getting fired at all. I tried checking similar posts, one such post mentioned to remove portrait/landscape mode from the activity which I tried. Any suggestion on this would be helpful. Thanks.

    Tuesday, June 16, 2020 12:15 PM

All replies

  • User382871 posted

    Try to use the below configuration and check if the AndroidManifest is configured correctly for the 'LoginActivity'. Check the tutorial: https://docs.microsoft.com/en-us/xamarin/android/platform/android-manifest <activity android:name=".MyActivity" android:configChanges="orientation|keyboard|keyboardHidden" android:label="@string/app_name"> You could also try to place the configurations change code in the Activity class. [Activity(Label = "MyActivity", ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.Keyboard)]

    Wednesday, June 17, 2020 7:45 AM