我有主类(扩展应用程序),它存储静态主变量(应用程序的计算器)。因此暂停应用程序(主页按钮或致电)后
06-21 00:43:14.916: E/AndroidRuntime(26676): FATAL EXCEPTION: AsyncTask #1
06-21 00:43:14.916: E/AndroidRuntime(26676): java.lang.RuntimeException: An error occured while executing doInBackground()
06-21 00:43:14.916: E/AndroidRuntime(26676): at android.os.AsyncTask$3.done(AsyncTask.java:299)
06-21 00:43:14.916: E/AndroidRuntime(26676): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
06-21 00:43:14.916: E/AndroidRuntime(26676): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
06-21 00:43:14.916: E/AndroidRuntime(26676): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
06-21 00:43:14.916: E/AndroidRuntime(26676): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
06-21 00:43:14.916: E/AndroidRuntime(26676): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
06-21 00:43:14.916: E/AndroidRuntime(26676): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
06-21 00:43:14.916: E/AndroidRuntime(26676): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
06-21 00:43:14.916: E/AndroidRuntime(26676): at java.lang.Thread.run(Thread.java:856)
06-21 00:43:14.916: E/AndroidRuntime(26676): Caused by: java.lang.NullPointerException
06-21 00:43:14.916: E/AndroidRuntime(26676): at com.AMain$CalcTask.doInBackground(AMain.java:106)
06-21 00:43:14.916: E/AndroidRuntime(26676): at ru.ps.horoscope.AMain$CalcTask.doInBackground(AMain.java:1)
06-21 00:43:14.916: E/AndroidRuntime(26676): at android.os.AsyncTask$2.call(AsyncTask.java:287)
06-21 00:43:14.916: E/AndroidRuntime(26676): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
06-21 00:43:14.916: E/AndroidRuntime(26676): ... 5 more
106字符串:if (!_.calc.Calculated) CALCULATE_();
_ extends Application
如何修复它?
@Override
protected Void doInBackground(Void... arg0) {
// TODO Auto-generated method stub
if (!_.calc.Calculated) CALCULATE_();
return null;
}
答案 0 :(得分:0)
_
或calc
为空。您需要发布代码才能获得更多信息。