in the table mytable (id, resh, text) you need to delete the record by dResh entered in the first case, in the second case by dText.
this entry deletes everything ok
case R.id.btnDel: db.delete("mytable", "resh" + "='" + dResh + "'", null); break; and on this 0 reaction
case R.id.btnDel2: db.delete("mytable", "text" + "='" + dText + "'", null); break; here is given dText
spinner_text.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { // показываем позиция нажатого элемента(в переменную реш заносится значение выбранного элемента) dText = spinner_text.getSelectedItem().toString(); System.out.println(dText); } base
public class DBHelper extends SQLiteOpenHelper { public static final String TABLE = "mytable"; final String LOG_TAG = "логи"; public DBHelper(Context context) { // конструктор суперкласса super(context, "myDB", null, 1); } @Override public void onCreate(SQLiteDatabase db) { Log.d(LOG_TAG, "--- база создана ---"); // создаем таблицу с полями db.execSQL("create table "+TABLE+" (" + "id integer primary key autoincrement," + "resh text," + "text text" + ");"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { } public ArrayList<String> getAllProvinces(){ ArrayList<String> list=new ArrayList<String>(); SQLiteDatabase db = this.getReadableDatabase(); db.beginTransaction(); try { String selectQuery = "SELECT * FROM "+ TABLE; Cursor cursor = db.rawQuery(selectQuery, null); if(cursor.getCount() >0) { while (cursor.moveToNext()) { // Add province name to arraylist String resh= cursor.getString(cursor.getColumnIndex("resh")); list.add(resh); } } db.setTransactionSuccessful(); } catch (SQLiteException e) { e.printStackTrace(); } finally { db.endTransaction(); // End the transaction. db.close(); // Close database } return list; } }