I'm doing a class that extends Asynctask to make a modification to my database SQLite Android, to perform the query you must pass a parameter to the method of the query, but I do not know how to pass it to the Asynctask class, I have this for now:
public class AsyncTaskDB extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... voids) {
updateShowMain0(/*Parametro articulo*/);
return null;
}
public void updateShowMain0(String articulo){
SQLiteDatabase db = Utility.dbHelper.getReadableDatabase();
/*ContentValues valores = new ContentValues();
valores.put("showMain", 0);
Log.i("","Recibe la consulta");
return db.update("articles",valores,"description = ?", new String[]{articulo});
*/
db.execSQL("UPDATE articles SET showMain = 0 WHERE description = ?", new String[]{articulo});
Log.i("","Recibe la consulta");
}
}
I would like the doinbackground to run when changing the status of a checkbox, could someone guide me a little?
Greetings.