title: How to login to wordpress website before setting webView in android
body: <p>I have a wordpress site. I want to cast a webView onto a page which requires authentication. How can I set the user logged in?</p>
  
  <p>Please help me</p>
  
  <pre><code>public View onCreateView(LayoutInflater inflater, ViewGroup container,
                       Bundle savedInstanceState) {
      WebView wvCourse = (WebView) mainview.findViewById(R.id.wvCourse);
      wvCourse.loadUrl(url);
      WebSettings settings = wvCourse.getSettings();
      settings.setDomStorageEnabled(true);
      wvCourse.getSettings().setJavaScriptEnabled(true);
      wvCourse.setWebViewClient(new MyWebViewClient());
      return mainview;
  }
  
  public class MyWebViewClient extends WebViewClient {
  
      public void TestFunction() {
          Log.e("username", pref.getString("username_val", ""));
          Log.e("here","here");
      }
  
      @Override
      public void onReceivedHttpAuthRequest(WebView view,
                                        HttpAuthHandler handler, String host, String realm) {
          TestFunction();
          handler.proceed("user123","user_123");
      }
  }
  </code></pre>