2

I have developed android application. It opens HTML page which contains a POST form with one field. Here is it's HTML:

<form method="post">
   <input name="key" type="text"> <input type="submit">
</form>

I have followed suggestions from this post to properly store/restore WebView state while device orientation change and it works properly in most cases except following:

Step 1. When I run this application

Step 2. Populate form

Step 3. Submit form

Step 4. Change orientation of my device

I get Web Page Not available massage. Instead of just display restored WebView. Am I missing something in my activity or in some configs to make WebView properly change orientation after form was submitted with POST ?

Thanks in Advance:

P.S.

Here is are methods of my activity

    @Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    preferences = PreferenceManager.getDefaultSharedPreferences(this);
    webView = (WebView) findViewById(R.id.webview);

    if (savedInstanceState != null) {
        webView.restoreState(savedInstanceState);
    }
    else {
        loadPage();
    }
}

private void loadPage() {
    String url = preferences.getString(PrefsActivity.WOW_APP_URL, PrefsActivity.DEFAULT_URL);
    webView.loadUrl("http://192.168.1.101:8080/wow66/orientation.jsp");
}

@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
    webView.saveState(savedInstanceState);
    super.onSaveInstanceState(savedInstanceState);
}

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    webView.restoreState(savedInstanceState);
}
Community
  • 1
  • 1

0 Answers0