通过Gmail的用户ID和密码web视图中的Andr​​oid [英] Pass gmail user id and password to webView in Android

查看:132
本文介绍了通过Gmail的用户ID和密码web视图中的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何Gmail的用户ID和密码传递给web视图用于登录在Gmail?

How to pass gmail user id and password to webView for Login in Gmail?

推荐答案

我要补充一点,在加载HTML时,JavaScript函数的负载应该做的。要控制,你可以使用以下内容:

I would add that the load of the javascript function should be done when the html is loaded. To control that, you can use the following:

webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("file:///android_asset/test.html");

webview.setWebViewClient(new WebViewClient(){

    public void onPageFinished(WebView view, String url){   

         webview.loadUrl("javascript:init('" + theArgumentYouWantToPass + "')");
    }           
});

的test.html

test.html

<!DOCTYPE html>
<html>
<head>
    <title>Test</title>
</head>

<body>
hola
adios
</body>

<script type="text/javascript">

    function init(val){
    // Do whatever you want with your parameter val
    }
</script>
</html>

这篇关于通过Gmail的用户ID和密码web视图中的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆