I need help with comparing a column to a string. There is a column in the android database and it stores on and off in strings. I need to compare the column to “On” string and if there is any On in that column i need it to return true and if there is no on in the database return false how do i do this ?
my code
public boolean QuickTime(){
String myQuery = "SELECT * FROM DATABASE_TABLE_QUICK WHERE ALARM_ID_QUICK LIKE 'On' "; Cursor mCursor = databaseConnect.rawQuery(myQuery, null); if(mCursor.getCount()>0) //if at least one record contains 'on' return true; else return false; //no record was found with the word 'on' }
an easy (not the best) way to do it is with Rawquery .
so all you would have to do is something like:
all you would have to do is pass your sqlLite database, change the table name and the status column for your column name.