我有存储静态主变量(应用程序的计算器)的主类(扩展应用程序)。所以在暂停应用程序(主页按钮或通话)后
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;
}