zeenat Romana zeenat Romana - 2 years ago 75
SQL Question

Developing simple Quiz application with Local Sqlite databese but score not incress

Score not increase...how to fix this problem i am using local sqlite databse
quesion fetch from database correctly display on view the only problem is that it not incress the score ..dont give me correct resut

RadioGroup grp = (RadioGroup) findViewById(R.id.radioGroup1);
RadioButton answer = (RadioButton) findViewById(grp.getCheckedRadioButtonId());
Log.d("yourans", currentQ.getANSWER()+" "+answer.getText());
//problem is here score not incress ...
if (currentQ.getANSWER().equals(answer.getText())) {
Log.d("score", "Your score" + score);
Intent intent = new Intent(MainActivity.this, ResultActivity.class);
Bundle b = new Bundle();
b.putInt("score", score); //Your score
intent.putExtras(b); //Put your score to your next Intent

Answer Source

You are checking if the given answer (Letter A, B, C) is equal to the correct answers text. Your code increasing the score will never get called. answer.getText() does not return a single letter, it will give you the answers text. currentQ.getANSWER() instead will just give you the single letter the user selected.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download