Try this :
Cursor c = mDb.rawQuery(
"select * from table_name where column_name = ?",
new String[] { "search" });
EDIT :
Follow the tutorial of the given above link and add below method into TestAdapter
public Cursor get_tag_Data()
{
try
{
String sql ="select * from table_name where column_name = ?", new String[] { edittext.getText().toString().trim()}";
Cursor mCur = mDb.rawQuery(sql, null);
if (mCur!=null)
{
mCur.moveToNext();
}
return mCur;
}
catch (SQLException mSQLException)
{
Log.e(TAG, "getTestData >>"+ mSQLException.toString());
throw mSQLException;
}
}
and call this method from your class like:
TestAdapter mDbHelper = new TestAdapter(urContext);
mDbHelper.createDatabase();
mDbHelper.open();
Cursor testdata = mDbHelper.get_tag_Data();
mDbHelper.close();
EDIT:
Declare below method into your database class,
public List<String> getQuestions(String difficulty) {
public static List<String> question_Set;
question_Set = new ArrayList<String>();
Cursor c = mDb.rawQuery(
"select * from table_name where column_name = ?", new String[] { difficulty });
while (c.moveToNext()) {
question_Set.add(c.getString(1).trim());
}
return question_Set;
}
Now call like
DB.getQuestions(edittext.getText().toString().trim()); // DB is your database class name