0

I have a Android App using simple Webview. There are a number of input areas and textarea on the web. Currently when user change orientation of the mobile device, all the inputs got swiped out and refreshed. How can I retain all those inputs after orientation change?

I do not wish to limit users to have only portrait or landscape mode when using the app.

I have read these questions but seems they do not work. They are only related to preventing reload of activity.

Activity restart on rotation Android Change screen orientation in Android without reloading the activity

Thank you very much!

Community
  • 1
  • 1
user2335065
  • 2,337
  • 3
  • 31
  • 54

1 Answers1

0

In your activity

@Override

public void onConfigurationChanged(Configuration newConfig) {
    // TODO Auto-generated method stub
    super.onConfigurationChanged(newConfig);
    if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
        System.out.println("this's landscape");

    } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
        System.out.println("this's portrait");
    }
}

in your manifest(inside your activity tag)

android:configChanges="orientation|keyboardHidden|screenSize"
Karthika PB
  • 1,373
  • 9
  • 16