我在 View.getWindowVisibleDisplayFrame() 方法中遇到异常,我该怎么办?以下是 logcat 响应。
progressBar = (ProgressBar) findViewById(R.id.webview_progress);
webview = (WebView) findViewById(R.id.book_ticket);
webview.loadUrl("https://www.irctc.co.in/mobile");
webview.setWebChromeClient(new WebChromeClient(){
public void onProgressChanged(WebView view, int progress)
{
if(progress < 100 && progressBar.getVisibility() == ProgressBar.GONE){
progressBar.setVisibility(ProgressBar.VISIBLE);
}
progressBar.setProgress(progress);
if(progress == 100) {
progressBar.setVisibility(ProgressBar.GONE);
}
}
});
日志猫
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:200)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
at java.lang.Thread.run(Thread.java:1019)
Caused by: java.lang.NullPointerException
at android.view.View.getWindowVisibleDisplayFrame(View.java:4082)
at com.pad.android.util.AdRequest.makeLBRequest(AdRequest.java:113)
at com.pad.android.iappad.AdTask.doInBackground(AdTask.java:70)
at com.pad.android.iappad.AdTask.doInBackground(AdTask.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:185)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
... 4 more