Jor*_*sys 6 multithreading android illegalstateexception android-4.4-kitkat webviewchromium
当我尝试使用Android 4.4(Kit kat)在我的nexus 4上打开webview时,我会收到以下错误消息:
Calling View methods on another thread than the UI thread.;
java.lang.IllegalStateException: Calling View methods on another thread than the UI thread.
com.android.webview.chromium.WebViewChromium.createThreadException(WebViewChromium.java:268)
Run Code Online (Sandbox Code Playgroud)
自从我更新到Android 4.4我的Nexus 4.
你的代码是什么样的?你可以试试
runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Your code
}
});
Run Code Online (Sandbox Code Playgroud)
只需检查4.4 google的迁移网页视图,并在此处更改了一些内容
runOnUiThread(new Runnable() {
@Override
public void run() {
// Code for WebView goes here
}
});
// This code is BAD and will block the UI thread
webView.loadUrl("javascript:fn()");
while(result == null) {
Thread.sleep(100);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8012 次 |
| 最近记录: |