I am trying to compare a field named NAME of type TEXT with a variable that I have in another activity, how could I get that field that contains the name of a user and be able to compare it?
It would be something like this.
public Cursor consultar(String busqueda) {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = null;
if(busqueda != null) {
cursor = db.query(TABLE_PROVEEDORES, new String[]{ID, NOMBRE, FECHA}, NOMBRE + " LIKE?", new String[]{busqueda+"%"}, null, null, null);
}
if (cursor != null) {
cursor.moveToFirst();
return cursor;
} else {
return null;
}
}
this will return a course in this case use the clause LIKE
, and just call this method and you returned a cursor, and with that you access the information you need.