Problem: Information on the screen resets when I turn the screen


I have made a simple Xamarin aplication with a few buttons and textboxes but my problem is that when I turn my tablet from landscape to portrait and vice versa the information in the window reset as if I just started the app. Is there any way to solve this problem?



  • DariuszSrokaDariuszSroka PLMember ✭✭

    By default when you rotate tablet current activity is restarted. You can block this in AndroidManifest...
    <activity android:name="MainActivity" android:configChanges="keyboardHidden|orientation|screenSize">

    You can read about rotating here

  • JaredBagleyJaredBagley USMember ✭✭

    Be forewarned that if you simply override the orientation you'll be delaying the problem if you don't implement an OnSaveInstanceState method, and reload from that data using your bundle in OnCreate. Otherwise, the same problem will occur whenever your app is starved for resources; such as when the User turns off phone for a bit, OS ends activity to save reources, then reinitializes when user unlocks phone, or when they leave there phone running but open enough apps that yours gets pushed out of memory.

Sign In or Register to comment.