I am new to programming for Android devices. I have two activities, in the first activity I send an integer value from the first activity to the second activity.
How can I add this variable in sqlite query which I receive from my first activity?
I want to add booknumber where in query written b=1 I want replace 1 with booknumber
private void setData() {
Intent mIntent = getIntent();
int booknumber= mIntent.getIntExtra("booknumber", 0);
stringArrayList = new ArrayList<>();
mDBHelper = new DatabaseHelper(this);
mDb = mDBHelper.getReadableDatabase();
Cursor cursor = mDb.rawQuery("select DISTINCT c from t_asv where b=1", new String[]{});
if(cursor!=null && cursor.getCount() > 0)
{
if (cursor.moveToFirst())
{
do {
stringArrayList.add(cursor.getString(0));
} while (cursor.moveToNext());
}
}