I have a ListView that reads data from sqlite with SimpleCursorAdapter and the table has about 1000 rows but i’ve filtered my list in my Activity by date, so the filtered cursor contains 2 rows for that special day.Therefor i wanted to add a custom row number(can’t use _id) for my list.one soloution that i’ve tought about,was ViewBinder, here is my code:
adapter.setViewBinder(new ViewBinder() {
public boolean setViewValue(View aView, Cursor aCursor, int aColumnIndex) {
if (aColumnIndex == 0) {
aCursor.moveToFirst();
if(aCursor.moveToFirst()) {
TextView textView = (TextView) aView;
textView.setText("" + WeeklyListRowNumber);
WeeklyListRowNumber = WeeklyListRowNumber + 1;
}
return true;
}
return false;
}
});
I have 11 columns in my List and WeeklyListRowNumber initialized 1 on the top,my problem is my rownumbers turns to 7,8 but it must be 1 , 2.can somebody tells me how can I solve this issue?
1 Answer