Forum Xamarin.Android

How to hold EditText control values on changing orientations.

I am working with EditText control in xmarine android c# project. It has both landscape and portrait mode, Here i am using a session variable to hold the EditText value to set again in both landscape and portrait mode. My session variable is holding values in orientation change but can not set value while changing the orientation to the EditText control. Every time it is showing blank EditText.

how to resolve this?


  • jezhjezh Member, Xamarin Team Xamurai

    you can try to add the following code:

       ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation

    it will not call the Oncreate() and remember the value of the EditText when you change the

          [Activity (ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
         public class MainActivity : AppCompatActivity{
Sign In or Register to comment.