Hi I want to open this url http://3864.cloud-matic.net/ from my android webview and I have tried many ways but the app even not opens mainActivity. What I have tried is below.
JavaScript
x
public void onCreate(Bundle state) {
super.onCreate(state);
setContentView(R.layout.main);
WebView webView = (WebView) findViewById(R.id.webView1);
webView.setHttpAuthUsernamePassword("cloud-matic.net/", "realm", username, password);
webView.loadUrl("http://3864.cloud-matic.net/");
}
Please give me idea where I am wrong. Ali
Advertisement
Answer
JavaScript
webview.setWebViewClient(new MyWebViewClient ());
private class MyWebViewClient extends WebViewClient {
@Override
public void onReceivedHttpAuthRequest(WebView view,
HttpAuthHandler handler, String host, String realm) {
handler.proceed("me@test.com", "mypassword");
}
}
This is most voted solution there I am not sure where to set the URL to open.Please suggest.