I have a cursor, and it got, lets say, 40 rows, I want to hide some rows when the user check a checkbox.
one way is run the query again on the cursor, but it doesn't help me because the condition is done by Java (calculate balance, with many logic).
I need something that will get the current row, and return if it can be show or not.
any help will be appreciated.
i inherit CursorWrapper and override some of the methods, here is the code:
public class SelectableCursorWrapper extends CursorWrapper {
private HashSet<Integer> mWhichShow;
public SelectableCursorWrapper(Cursor cursor, HashSet<Integer> 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);
}
}
}
thanks for anyone that try to help!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With