Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

persistChanges method is not working when table order is DESC #129

Open
vinit2209 opened this issue Sep 15, 2014 · 0 comments
Open

persistChanges method is not working when table order is DESC #129

vinit2209 opened this issue Sep 15, 2014 · 0 comments

Comments

@vinit2209
Copy link

when i set private final String sort_order = "DESC "; // ASC or DESC

Below method is not working properly. item numbers are not getting saved correctly.

public void persistChanges() {
Cursor c = getCursor();
c.moveToPosition(-1);
while (c.moveToNext()) {
int listPos = getListPosition(c.getPosition());
if (listPos == REMOVED) {
mDbHelper
.deleteItemRecord(c.getInt(c.getColumnIndex("_id")));
} else if (listPos != c.getPosition()) {
mDbHelper.updateItemPosition(
c.getInt(c.getColumnIndex("_id")), listPos);
}
}
}

plz correct me if i am wrong

thnks
vinit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant