2

My app is a simple form. I use TableLayout, and have a lot of rows set to visibility="gone". As user starts filling out the form, more and more rows become visible. But the problem is that the very second screen rotates from portrait to landscape or from landscape to portrait, the whole form resets, and all the fields that were visible become invisible. Is there any way to prevent this from happening?

Thanks in advance to anyone who helps :)

Quillion
  • 6,346
  • 11
  • 60
  • 97

1 Answers1

11

Add this line to your Manifest.xml file, this will prevent of calling onCreate() when screen rotates.

<activity android:name=".yourActivity" android:configChanges="keyboardHidden|orientation">

Version above Android 3.2, you also need to add "screenSize":

<activity android:name=".yourActivity" android:configChanges="keyboardHidden|orientation|screenSize">
Mohammed Azharuddin Shaikh
  • 41,633
  • 14
  • 96
  • 115