mardi 6 octobre 2015

Android Search Query and Sort in order

Anyone has an idea how this is done? I have a regular search query below that displays matching data in a listview, i tried putting COLUMN NAME + " ASC" at the order part, but i got errors.

                public Cursor getSearch(String query)
            {
                SQLiteDatabase db = this.getReadableDatabase();
                Cursor c = db.query(true, DATABASE_TABLE, ALL_KEYS, KEY_NAME + " LIKE ?",
                        new String[] {"%"+ query+ "%" }, null, null, null,
                        null);

                if(c != null)
                {
                c.moveToFirst();
                }
                return c;
            }

Aucun commentaire:

Enregistrer un commentaire