我实现了一个 onResume() 方法,里面有一个刷新代码,我遇到了一个错误
这是我的代码
// After completing background task Dismiss the progress dialog
protected void onPostExecute(String file_url) {
// dismiss the dialog after getting all events
pDialog.dismiss();
// updating UI from Background Thread
runOnUiThread(new Runnable() {
public void run() {
// Updating parsed JSON data into ListView
adapter = new SimpleAdapter(BookmarkActivity.this,
eventsList, R.layout.bookmark_list, new String[] {
TAG_EID, TAG_ENAME, TAG_CNAME,
TAG_CREATED_AT }, new int[] { R.id.bk_eid,
R.id.bk_ename, R.id.bk_cname,
R.id.bk_created_at });
// updating listView
setListAdapter(adapter);
}
});
}
public void onResume(){
super.onResume();
((BaseAdapter) adapter).notifyDataSetChanged();
}
这是我的 logcat 错误
09-05 07:39:36.223: E/AndroidRuntime(626): Caused by: java.lang.NullPointerException
09-05 07:39:36.223: E/AndroidRuntime(626): at com.stts.sparetimetradingsystem.BookmarkActivity.onResume(BookmarkActivity.java:215)
09-05 07:39:36.223: E/AndroidRuntime(626): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1149)
09-05 07:39:36.223: E/AndroidRuntime(626): at android.app.Activity.performResume(Activity.java:3823)
09-05 07:39:36.223: E/AndroidRuntime(626): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3118)
09-05 07:39:36.223: E/AndroidRuntime(626): ... 12 more
我该如何解决这个问题?