我有一个光标,它有40行,我想在用户勾选复选框时隐藏一些行.
一种方法是在光标上再次运行查询,但它对我没有帮助,因为条件是由Java完成的(计算余额,有很多逻辑).
我需要能得到当前行的东西,如果可以显示则返回.
任何帮助将不胜感激.
我继承了CursorWrapper并覆盖了一些方法,这里是代码:
public class SelectableCursorWrapper extends CursorWrapper { private HashSetmWhichShow; public SelectableCursorWrapper(Cursor cursor, HashSet whichToShow) { super(cursor); mWhichShow = whichToShow; } @Override public int getCount() { return mWhichShow.size(); } @Override public boolean moveToPosition(int position) { if (position >= super.getCount()) { return false; } if (mWhichShow.contains(position)) { return super.moveToPosition(position); } else { // Recursion on this method to move to the next element properly return this.moveToPosition(position + 1); } } }
感谢任何试图帮助的人!