java - Check if int from database string is equal to certain value -


i want check if database variable has value 5 , change image. log.d before check if statment gives me value 5 , headline want check for, data in database. if-statement not executed, "done" not logged , image not changed. maybe using wrong way parse cursor.getstring(0) integer? there no error logged.

dbhelper dbh  = new dbhelper(context);     cursor cursor = dbh.getscore(dbh);     cursor.movetofirst();     if (cursor.movetofirst()) {         {             log.d("database", cursor.getstring(0) + cursor.getstring(1));             if (integer.parseint(cursor.getstring(0))== 5 && headline.tostring().equals(cursor.getstring(1))){                 log.d("database","done");                 imagedone.setimageresource(r.drawable.markerdone);             }         }         while(cursor.movetonext());     }     cursor.close(); 

i had same problem when trying parse int mysql db fixed :

 if (math.round(float.parsefloat(cursor.getstring(0))== 5 && headline.tostring().equals(cursor.getstring(1))){             log.d("database","done");             imagedone.setimageresource(r.drawable.markerdone);         } 

Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -