Android and h5 interaction (h5 part)

Reference link:
1. Android can't pop up the alert box
https://blog.csdn.net/xiewensheng1126/article/details/78285651?tdsourcetag=s_pctim_aiomsg
2. Webview and js interaction
https://blog.csdn.net/carson_ho/ article/details/64904691/
3. How to realize interaction
https://www.cnblogs.com/renhui/p/5893099.html

This article mainly refers to the third link.

<!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>

Requirement: Adapt 4.0-4.4, so to realize the idea, java calls the js method (getValues), after the js method is executed, call the java code again to return the value (window.native.getValues(jsonStr)).
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_42645716/article/details/88424207