bauerca / drag-sort-listview

Android ListView with drag and drop reordering.
3.2k stars 1.44k forks source link

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

Open vinit2209 opened 10 years ago

vinit2209 commented 10 years ago

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