how to delete a row in first position the sqlite in android

android, sqlite

Solution

use this method to delete first row

    public void deleteFirstRow()
{
    db.open();
    Cursor cursor = db.query(TABLE_CONTACTS, null, null, null, null, null, null); 

        if(cursor.moveToFirst()) {
            String rowId = cursor.getString(cursor.getColumnIndex(KEY_ID)); 

            db.delete(TABLE_CONTACTS, KEY_ID + "=?",  new String[]{rowId});
           }
db.close();
    }   

Problem

How to delete a row in first position the sqlite in android Now i am using this code for delete the row ``` public void delete(String id) { SQLiteDatabase db = this.getReadableDatabase(); db.delete(TABLE_CONTACTS, KEY_ID + "=?", new String[]{id}); // db.execSQL(TABLE_CONTACTS , " ORDER BY " + KEY_ID + " ASC;"); db.close(); } ``` But i want to delete the row in first position. Because KEY_ID will not be the same all the time when deletion occur

Original source