下面是我的onPostExecute
方法。当我AsyncTask
触发它时,它会做它应该做的所有事情,但是当它试图执行我的应用程序时onPostExecute
,我的应用程序崩溃了,我在我的logcat
09-14 22:45:22.481: E/AndroidRuntime(1141): FATAL EXCEPTION: main
09-14 22:45:22.481: E/AndroidRuntime(1141): java.lang.NullPointerException
09-14 22:45:22.481: E/AndroidRuntime(1141): at com.testapp1.ListView$LoadAllData.onPostExecute(ListView.java:193)
09-14 22:45:22.481: E/AndroidRuntime(1141): at com.testapp1.ListView$LoadAllData.onPostExecute(ListView.java:1)
09-14 22:45:22.481: E/AndroidRuntime(1141): at android.os.AsyncTask.finish(AsyncTask.java:631)
09-14 22:45:22.481: E/AndroidRuntime(1141): at android.os.AsyncTask.access$600(AsyncTask.java:177)
09-14 22:45:22.481: E/AndroidRuntime(1141): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
09-14 22:45:22.481: E/AndroidRuntime(1141): at android.os.Handler.dispatchMessage(Handler.java:99)
09-14 22:45:22.481: E/AndroidRuntime(1141): at android.os.Looper.loop(Looper.java:137)
09-14 22:45:22.481: E/AndroidRuntime(1141): at android.app.ActivityThread.main(ActivityThread.java:5041)
09-14 22:45:22.481: E/AndroidRuntime(1141): at java.lang.reflect.Method.invokeNative(Native Method)
09-14 22:45:22.481: E/AndroidRuntime(1141): at java.lang.reflect.Method.invoke(Method.java:511)
09-14 22:45:22.481: E/AndroidRuntime(1141): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
09-14 22:45:22.481: E/AndroidRuntime(1141): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
09-14 22:45:22.481: E/AndroidRuntime(1141): at dalvik.system.NativeStart.main(Native Method)
这是我的onPostExecute
方法
@Override
protected void onPostExecute(String file_URL) {
if(file_URL.equals("0")) {
pDialog.dismiss();
Toast.makeText(ListView.this, "No data found", Toast.LENGTH_SHORT).show();
finish();
}else{
if (pDialog != null && pDialog.isShowing()) pDialog.dismiss();
ListAdapter adapter = new SimpleAdapter(getBaseContext(), questionList,
R.layout.listelements,
new String[] { TAG_QUESTION_SUBJECT }, new int[] {
R.id.Subject,});
setListAdapter(adapter);
}}}
我可以请人帮忙解决我遇到的这个问题。