dimanche 11 octobre 2015

get a single row from table with search field and search button

//get a single row from table
public String getEquipment(String equipment_id){
    Cursor cursor = null;
    equipment_id = "";
    try {
        SQLiteDatabase database = this.getReadableDatabase();
        cursor = database.rawQuery("SELECT description FROM tbl_equipments WHERE equipment_id=?", new String[] {equipment_id + ""});

        if (cursor.getCount() > 0 ) {
            cursor.moveToFirst();
            equipment_id = cursor.getString(cursor.getColumnIndex("description"));
        }
        return equipment_id;
    }finally {
        cursor.close();
    }
}

can someone teach me how to get a single row from table and display it to textview with search field and search button implements with SearchEquipment Activity.

Aucun commentaire:

Enregistrer un commentaire