Buggy code:
private TextView oFour ; private TextView message ; private ImageButton back ; private ImageButton again ; private ImageButton done ; private ImageButton next ; private String sText ; private String tText ; private String pText ; private LinearLayout complete ; private int wrongO ; private boolean wrong = false ; private boolean s = true ; @ Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; requestWindowFeature ( FEATURE_NO_TITLE ) ; setRequestedOrientation ( SCREEN_ORIENTATION_PORTRAIT ) ; setContentView ( activity_worry_heads ) ; oLayout = ( ( RelativeLayout ) ( findViewById ( R . id . oLayout ) ) ) ; msgLayout = ( ( RelativeLayout ) ( findViewById ( R . id . msgLayout ) ) ) ; sView = ( ( ImageView ) ( findViewById ( R . id . sView ) ) ) ; tView = ( ( ImageView ) ( findViewById ( R . id . tView ) ) ) ; o1 = ( ( ImageView ) ( findViewById ( R . id . oOne ) ) ) ; o2 = ( ( ImageView ) ( findViewById ( R . id . oTwo ) ) ) ; o3 = ( ( ImageView ) ( findViewById ( R . id . oThree ) ) ) ; o4 = ( ( ImageView ) ( findViewById ( R . id . oFour ) ) ) ; oOne = ( ( TextView ) ( findViewById ( oOneTxt ) ) ) ; oTwo = ( ( TextView ) ( findViewById ( oTwoTxt ) ) ) ; oThree = ( ( TextView ) ( findViewById ( oThreeTxt ) ) ) ; oFour = ( ( TextView ) ( findViewById ( oFourTxt ) ) ) ; message = ( ( TextView ) ( findViewById ( R . id . message ) ) ) ; back = ( ( ImageButton ) ( findViewById ( whBackBtn ) ) ) ; again = ( ( ImageButton ) ( findViewById ( againBtn ) ) ) ; done = ( ( ImageButton ) ( findViewById ( whDoneBtn ) ) ) ; next = ( ( ImageButton ) ( findViewById ( whNextBtn ) ) ) ; complete = ( ( LinearLayout ) ( findViewById ( completeLayout ) ) ) ; sView . setOnClickListener ( this ) ; tView . setOnClickListener ( this ) ; oOne . setOnClickListener ( this ) ; oTwo . setOnClickListener ( this ) ; oThree . setOnClickListener ( this ) ; oFour . setOnClickListener ( this ) ; back . setOnClickListener ( this ) ; again . setOnClickListener ( this ) ; done . setOnClickListener ( this ) ; next . setOnClickListener ( this ) ; Typeface t = Typeface . createFromAsset ( getAssets ( ) , "agentorange.ttf" ) ; oOne . setTypeface ( t ) ; oTwo . setTypeface ( t ) ; oThree . setTypeface ( t ) ; oFour . setTypeface ( t ) ; message . setTypeface ( t ) ; DBHelper helper = new DBHelper ( this ) ; db = helper . getDB ( ) ; try { Calendar ca = Calendar . getInstance ( ) ; ca . set ( ca . get ( Calendar . YEAR ) , ca . get ( Calendar . MONTH ) , ca . get ( Calendar . DAY_OF_MONTH ) , 0 , 0 , 0 ) ; Cursor c = db . rawQuery ( ( ( ( ( "SELECT<seq2seq4repair_space>S<seq2seq4repair_space>FROM<seq2seq4repair_space>WORRYHEADS_COMPLETION<seq2seq4repair_space>where<seq2seq4repair_space>TIMESTAMP<seq2seq4repair_space><<seq2seq4repair_space>" + ( ca . getTimeInMillis ( ) ) ) + "<seq2seq4repair_space>AND<seq2seq4repair_space>S<seq2seq4repair_space>not<seq2seq4repair_space>in<seq2seq4repair_space>(SELECT<seq2seq4repair_space>S<seq2seq4repair_space>FROM<seq2seq4repair_space>WORRYHEADS_COMPLETION<seq2seq4repair_space>where<seq2seq4repair_space>TIMESTAMP<seq2seq4repair_space>><seq2seq4repair_space>" ) + ( ca . getTimeInMillis ( ) ) ) + ")" ) , null ) ; c . moveToFirst ( ) ; ContentValues v ; for ( int x = 0 ; x < ( c . getCount ( ) ) ; x ++ ) { v = new ContentValues ( ) ; v . put ( "COMPLETED_FLAG" , 0 ) ; <START_BUG> db . update ( "STOP_WORRYHEADS" , v , ( "S<seq2seq4repair_space>=<seq2seq4repair_space>" + ( c . getInt ( c . getColumnIndex ( "S" ) ) ) ) , null ) ; <END_BUG> c . moveToNext ( ) ; } c . close ( ) ; c = db . rawQuery ( "SELECT<seq2seq4repair_space>*<seq2seq4repair_space>from<seq2seq4repair_space>STOP_WORRYHEADS<seq2seq4repair_space>where<seq2seq4repair_space>COMPLETED_FLAG<seq2seq4repair_space>=<seq2seq4repair_space>0" , null ) ; if ( ( c . getCount ( ) ) > 0 ) { Random num = new Random ( System . currentTimeMillis ( ) ) ; int position = ( ( int ) ( ( c . getCount ( ) ) * ( num . nextDouble ( ) ) ) ) ; c . moveToPosition ( position ) ; wrongO = ( ( int ) ( ( num . nextDouble ( ) ) * 3 ) ) ; sText = c . getString ( c . getColumnIndex ( "S" ) ) ; tText = c . getString ( c . getColumnIndex ( "T" ) ) ; pText = c . getString ( c . getColumnIndex ( "P" ) ) ; String [ ] o = new String [ 4 ] ; o [ 0 ] = c . getString ( c . getColumnIndex ( "O1" ) ) ; o [ 1 ] = c . getString ( c . getColumnIndex ( "O2" ) ) ; o [ 2 ] = c . getString ( c . getColumnIndex ( "O3" ) ) ; o [ 3 ] = c . getString ( c . getColumnIndex ( "O_WRONG" ) ) ; populateO ( o ) ; message . setText ( ( "Situation:\n\n" + ( sText ) ) ) ; } else { message . setText ( "You've<seq2seq4repair_space>completed<seq2seq4repair_space>all<seq2seq4repair_space>of<seq2seq4repair_space>them!" ) ; next . setVisibility ( GONE ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } } private void populateO ( String [ ] o ) { } private void resize ( ) { } @ Override public void onClick ( View v ) { } private void wrongSelection ( ) { } private void complete ( String msg ) { }

Fix:
db . update ( "STOP_WORRYHEADS" , v , ( ( "S<seq2seq4repair_space>=<seq2seq4repair_space>\"" + ( c . getString ( c . getColumnIndex ( "S" ) ) ) ) + "\"" ) , null ) ;