实用widget方式集成后,目前发现在乐视手机上无法切换tab,只能显示默认第一个,在debug模式下,发现以下信息:
W/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) {cc4ce32} called on Looper (JavaBridge, tid 983) {d93ea04}, FYI main Looper is Looper (main, tid 1) {cc4ce32})
at android.webkit.WebView.checkThread(WebView.java:2559)
at android.webkit.WebView.getUrl(WebView.java:1592)
at io.dcloud.feature.ui.c.a(NWindow.java:597)
at io.dcloud.feature.ui.e.a(UIWidgetMgr.java:218)
at io.dcloud.feature.ui.UIFeatureImpl.execute(UIFeatureImpl.java:32)
at io.dcloud.feature.b.a(FeatureMgr.java:303)
at io.dcloud.feature.b.processEvent(FeatureMgr.java:133)
at io.dcloud.common.b.a.dispatchEvent(Core.java:392)
at io.dcloud.common.b.b.j.processEvent(WindowMgr.java:118)
at io.dcloud.common.b.b.h.exec(DHWebview.java:165)
at io.dcloud.common.b.b.h.prompt(DHWebview.java:143)
at io.dcloud.common.util.Birdge.prompt(Birdge.java:21)
at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:39)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.os.HandlerThread.run(HandlerThread.java:61)
W/System.err: java.lang.RuntimeException: 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) {cc4ce32} called on Looper (JavaBridge, tid 983) {d93ea04}, FYI main Looper is Looper (main, tid 1) {cc4ce32})
W/System.err: at android.webkit.WebView.checkThread(WebView.java:2569)
W/System.err: at android.webkit.WebView.getUrl(WebView.java:1592)
W/System.err: at io.dcloud.feature.ui.c.a(NWindow.java:597)
W/System.err: at io.dcloud.feature.ui.e.a(UIWidgetMgr.java:218)
W/System.err: at io.dcloud.feature.ui.UIFeatureImpl.execute(UIFeatureImpl.java:32)
W/System.err: at io.dcloud.feature.b.a(FeatureMgr.java:303)
W/System.err: at io.dcloud.feature.b.processEvent(FeatureMgr.java:133)
W/System.err: at io.dcloud.common.b.a.dispatchEvent(Core.java:392)
W/System.err: at io.dcloud.common.b.b.j.processEvent(WindowMgr.java:118)
W/System.err: at io.dcloud.common.b.b.h.exec(DHWebview.java:165)
W/System.err: at io.dcloud.common.b.b.h.prompt(DHWebview.java:143)
W/System.err: at io.dcloud.common.util.Birdge.prompt(Birdge.java:21)
W/System.err: at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
W/System.err: at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:39)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:111)
W/System.err: at android.os.Looper.loop(Looper.java:207)
W/System.err: at android.os.HandlerThread.run(HandlerThread.java:61)
W/System.err: Caused by: 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) {cc4ce32} called on Looper (JavaBridge, tid 983) {d93ea04}, FYI main Looper is Looper (main, tid 1) {cc4ce32})
W/System.err: at android.webkit.WebView.checkThread(WebView.java:2559)
W/System.err: ... 16 more
D/cr_Ime: [InputMethodManagerWrapper.java:56] isActive: true
D/cr_Ime: [InputMethodManagerWrapper.java:65] hideSoftInputFromWindow
求帮忙指导,附上tab 点击事件代码:
//添加点击事件
function tapBaritem(){
mui('.mui-bar-tab').on('tap','.mui-tab-item',function(){
var baritem = this;
var baritemurl = baritem.getAttribute('href');
//indexof()如果为false返回-1所以前面加上~
if (!~curBarItemWebview.getURL().indexOf(baritemurl)) {
for (var i = 0; i < barItemArray.length; i++) {
if (barItemArray[i] == baritemurl) {
//切换baritemwebview
barItemWebviewArray[i].show();
curBarItemWebview = barItemWebviewArray[i];
for(var j=0; j < barItemArray.length; j++){
if(j!=i){
barItemWebviewArray[j].hide();
}
}
var curWeb = plus.webview.getWebviewById(subViewArray[i]);
curWeb.evalJS("alertabc();");
break;
}
}
}
});
}
1 个回复
起伏的水
同样的问题,我的在Android6.0以上的手机上也是这样.楼主解决了吗?