public void checkResult() { int maxScore; if (nummovecount == GetOptimalValue()) { maxScore = numscore + colWidth * 100; showDialog( "Congo You Do It !\n Total Move " + nummovecount + "\nYour Score : " + maxScore, true); } else { maxScore = numscore; showDialog( "Ohh You miss it.\n Total Move by you " + nummovecount + "\n Required : " + GetOptimalValue() + "\nYour Score : " + numscore, false); } Cursor rs = mydb.getMyData(1); rs.moveToFirst(); if (maxScore > rs.getInt(rs.getColumnIndex(DBHelper.MSCORE))) { mydb.updateScore(1, maxScore, ""); } if (!rs.isClosed()) rs.close(); }