I have taken String value from a EditText and set it inside SELECT QUERY after WHERE condition
As
TextView tv
Detailed answer:
String[] selectionArgs = new String[]{name};
Cursor c = db.rawQuery(" SELECT * FROM " + tabl1 + " WHERE " + name + " = ? ", selectionArgs);
selectionArgs : this takes the 'name' you desire to compare with, as argrument.
Here note "A Cursor object, which is positioned before the first entry of the table you refer to".
So,to move to first entry :
c.moveToFirst();
getColumnIndex(String ColumnName) : this returns the zero-based column index for the given column name.
tv.setText(c.getString(c.getColumnIndex("email")));
In case, you want to go searching through multiple rows for a given name under 'name' column then use loop as below:
if (cursor.moveToFirst()){
do{
////go traversing through loops
}while(cursor.moveToNext());
This should solve the problem.