这是堆栈跟踪:
06-10 09:14:18.149: E/AndroidRuntime(1230): FATAL EXCEPTION: main
06-10 09:14:18.149: E/AndroidRuntime(1230): java.lang.NullPointerException
06-10 09:14:18.149: E/AndroidRuntime(1230): at ca.TwentyTwenty.cropinspection.GeneralSpinnerDialogFragment$AsyncSaver.onPostExecute(GeneralSpinnerDialogFragment.java:140)
06-10 09:14:18.149: E/AndroidRuntime(1230): at ca.TwentyTwenty.cropinspection.GeneralSpinnerDialogFragment$AsyncSaver.onPostExecute(GeneralSpinnerDialogFragment.java:1)
06-10 09:14:18.149: E/AndroidRuntime(1230): at android.os.AsyncTask.finish(AsyncTask.java:631)
06-10 09:14:18.149: E/AndroidRuntime(1230): at android.os.AsyncTask.access$600(AsyncTask.java:177)
06-10 09:14:18.149: E/AndroidRuntime(1230): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
06-10 09:14:18.149: E/AndroidRuntime(1230): at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 09:14:18.149: E/AndroidRuntime(1230): at android.os.Looper.loop(Looper.java:137)
06-10 09:14:18.149: E/AndroidRuntime(1230): at android.app.ActivityThread.main(ActivityThread.java:5041)
06-10 09:14:18.149: E/AndroidRuntime(1230): at java.lang.reflect.Method.invokeNative(Native Method)
06-10 09:14:18.149: E/AndroidRuntime(1230): at java.lang.reflect.Method.invoke(Method.java:511)
06-10 09:14:18.149: E/AndroidRuntime(1230): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-10 09:14:18.149: E/AndroidRuntime(1230): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-10 09:14:18.149: E/AndroidRuntime(1230): at dalvik.system.NativeStart.main(Native Method)
这是代码
FieldDetailItem fd = ((FieldActivity) getActivity()).fieldDetails.get(list_position);
我很确定这与 fieldDetails 可能在 Asynctask 返回时不存在有关,但我不确定这里还能做什么。我有哪些选择?
谢谢。