在Android中,我写了一个类
public class ImageAdapter extends BaseAdapter {
private Context context;
private Cursor imageCursor;
public ImageAdapter(Context context, Cursor imageCursor) {
this.context = context;
this.imageCursor = imageCursor;
}
}
在这段代码中,我想在调用notifyDataSetChanged()方法时更新 imageCursor 变量的值。 我怎么能这样做?
答案 0 :(得分:0)
您可以覆盖notifyDatasetChanged()并在调用super.notifyDatasetChanged之前放置代码,或者创建这样的自定义方法,
public void updateNotifyDatasetChanged(Cursor newImageCursor){
this.imageCursor = newImageCursor;
notifyDatasetChanged();
}