小编Roa*_*dog的帖子

在CustomCursor Adapater中获取正确的光标getView()

我有一个自定义游标适配器,其中每行包含一个复选框,文本视图和按钮.该按钮最初设置为GONE,当用户选中我希望按钮显示的复选框时,用户可以单击它并删除相应的行.

我的问题是,在我的getView()中,我无法获得正确的光标,所以不断获取cursorOutOfBoundsExceptions.

如果我不再需要它,我也想删除bindView().

public class DeleteCampaignCustomCursorAdapater extends CursorAdapter {

protected static final String TAG = null;
DatabaseHelper myDbHelper;
protected SQLiteDatabase db;
private final Activity context;

private LayoutInflater mInflater;
protected ListView mListView;

private Cursor c;
public static int[] checked;

TextView merchantNameView;
Button deleteButton;
CheckBox selectForDelete;
//ImageView moveButton;

public DeleteCampaignCustomCursorAdapater(Context context, Cursor c) {
    super(context, c);
    this.context = (Activity) context;
    mInflater = LayoutInflater.from(context);
    this.c = c;
    initializeChecked();
}

@Override
public void bindView(View view, Context context, final Cursor cursor) {

    /*myDbHelper …
Run Code Online (Sandbox Code Playgroud)

android listview custom-cursor

6
推荐指数
1
解决办法
2230
查看次数

标签 统计

android ×1

custom-cursor ×1

listview ×1