Android WebView - remember username and password

I am creating a basic WebView application that will load a web page. This web page requires a login. When I go out or refresh the page, it displays me. How can I log in? The following code is my attempt, based on some research, but apparently I do not understand this concept. And so I can kill two birds with one stone, can someone let me know how to prevent page refresh when turning the phone? Is it possible? Thanks for any help in advanced form.

    public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);

  mWebView = (WebView) findViewById(R.id.webview);
  mWebView.getSettings().setJavaScriptEnabled(true);
  mWebView.loadUrl("www.randomurl.com");
  mWebView.setWebViewClient(new HelloWebViewClient());
  CookieSyncManager.createInstance(this);
  CookieSyncManager.getInstance().startSync();
  CookieManager.getInstance();
 }
+3
source share
1 answer

, , . -, , -, ,

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
}

, !

+4

Source: https://habr.com/ru/post/1776756/


All Articles