有时我在我的应用程序中遇到此崩溃错误当我多次单击按钮时,它会崩溃,按钮是向服务器发送 SOAP 请求,完整的 logcat 如下:</p>
E/AndroidRuntime(16290): FATAL EXCEPTION: AsyncTask #1
06-06 15:17:16.003: E/AndroidRuntime(16290): java.lang.RuntimeException: An error occured while executing doInBackground()
06-06 15:17:16.003: E/AndroidRuntime(16290): at android.os.AsyncTask$3.done(AsyncTask.java:200)
06-06 15:17:16.003: E/AndroidRuntime(16290): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
06-06 15:17:16.003: E/AndroidRuntime(16290): at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
06-06 15:17:16.003: E/AndroidRuntime(16290): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
06-06 15:17:16.003: E/AndroidRuntime(16290): at java.util.concurrent.FutureTask.run(FutureTask.java:138)
06-06 15:17:16.003: E/AndroidRuntime(16290): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
06-06 15:17:16.003: E/AndroidRuntime(16290): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
06-06 15:17:16.003: E/AndroidRuntime(16290): at enter code herejava.lang.Thread.run(Thread.java:1027)
06-06 15:17:16.003: E/AndroidRuntime(16290): Caused by: java.lang.NullPointerException
06-06 15:17:16.003: E/AndroidRuntime(16290): at com.bgi.genebook.task.QueryCalAllDataTask.doInBackground(QueryCalAllDataTask.java:24)
06-06 15:17:16.003: E/AndroidRuntime(16290): at com.bgi.genebook.task.QueryCalAllDataTask.doInBackground(QueryCalAllDataTask.java:1)
06-06 15:17:16.003: E/AndroidRuntime(16290): at android.os.AsyncTask$2.call(AsyncTask.java:185)
06-06 15:17:16.003: E/AndroidRuntime(16290): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
06-06 15:17:16.003: E/AndroidRuntime(16290): ... 4 more
点击按钮将运行代码:
Map<String, Object> mapSyc = new HashMap<String, Object>();
mapSyc.clear();
QueryCalAllDataTask<VipOxygen> task = new QueryCalAllDataTask<VipOxygen>(
this);
mapSyc.put("date", date);
mapSyc.put("wsdl", VipBloodOxygenWebService.wsdl);
task.execute(mapSyc);
QueryCalAllDataTask.java 是:
public class QueryCalAllDataTask<T> extends
AsyncTask<Map<String, Object>, Integer, List<Map<String, String>>> {
GBListener<T> listener;
public QueryCalAllDataTask(GBListener<T> listener) {
this.listener = listener;
}
@Override
protected synchronized List<Map<String, String>> doInBackground(Map<String, Object>... params) {
List<Map<String, String>> contentListDay = new ArrayList<Map<String, String>>();
Log.e("OPERATE", params[0].get("wsdl").toString()); // line 24
try{
contentListDay = (List<Map<String, String>>)BaseWebService.getDataAllDaysCountOfMouth(params[0]
.get("wsdl").toString(), params[0].get("date").toString());
}catch(Exception e){
}
return contentListDay;
}
@Override
protected void onPostExecute(List<Map<String, String>> list) {
System.out.println("QueryTask.onPostExecute()" + list);
listener.getAllCalData(list);
}
@Override
protected void onProgressUpdate(Integer... values) {
System.out.println(values);
}
}
谁能帮助我?为什么?当我多次单击该按钮时,此崩溃偶尔会出现一次!