我有一个wordpress网站。我想将webView转换为需要身份验证的页面。如何设置用户登录?
请帮帮我
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");
}
}