Android与h5交互(h5部分)

参考链接:
1.安卓不能弹出alert弹框
https://blog.csdn.net/xiewensheng1126/article/details/78285651?tdsourcetag=s_pctim_aiomsg
2.webview与js交互
https://blog.csdn.net/carson_ho/article/details/64904691/
3.交互如何实现
https://www.cnblogs.com/renhui/p/5893099.html

本文主要参考第三个链接。

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Page Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="js/jquery-1.8.3.min.js"></script>
</head>
<body>
    <script>
    var jsonStr = '{"id":"001","type":"test"}';
    function getValues() {  
        window.native.getLemmaValues(jsonStr)
    }
    </script>
</body>
</html>

要求:适配4.0-4.4,所以,实现思路, java调用js方法(getValues),js方法执行完毕,再次调用java代码将值返回(window.native.getValues(jsonStr))。
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_42645716/article/details/88424207
今日推荐