安卓调用JS All WebView methods must be called on the same thread

来源:互联网 发布:python中tile函数 编辑:程序博客网 时间:2024/04/27 19:03

不多说了直接看代码


安卓:

wView.post(new Runnable() {    @Override    public void run() {        wView.loadUrl("javascript:fillContent()");    }});
网页:
<script language="javascript">    function fillContent(){         $('form').fadeIn(500);        $('.wrapper').removeClass('form-success');        $("#userName").val("密码或账号有误");         $("#passWord").val("");    }</script>
安卓不加线程可能会报错,错误内容如下:
/WebView: java.lang.Throwable: A WebView method was called on thread 'JavaBridge'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 1) {4a77ef00} called on Looper (JavaBridge, tid 113) {4a7894dc}, FYI main Looper is Looper (main, tid 1) {4a77ef00})

阅读全文
0 0
原创粉丝点击