score keeps increasing (old score + current score) , android
<p>I have an application which has questions. After answer all the questions, score will be saved. the problem is the application adds old score. </p>

<p>e.g : </p>

<p>first time take the exercise : i got 5 score
second time take the exercise : i got 10 score (i should get 5, but the application adds old score).
third time take the exercise : i got 14 score (i should get 4, but the application adds old score).</p>

<p>So, in this case, i have to quit the application first then run it again to get what i want, if not, so it keeps add the old score.</p>

<p>Is there anyone know about the problem? I use java which contains android library and sqlite.</p>

<pre><code>public class QuestActivity extends Activity implements OnClickListener{

DatabaseUsername helper=null;
private Quest currentQ;
private SetGame currentGame;
private int userId;
public static final String LOG_TAG = "RIKA";

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.questactivitylayout);
    currentGame = ((TheApplication)getApplication()).getCurrentGame();
    currentQ = currentGame.getNextQuestion();
    Button nextBtn = (Button) findViewById(R.id.nextBtn);
    final Button confirmBtn = (Button) findViewById(R.id.confirmBtn);
    setQuestions();

    helper=new DatabaseUsername(this);

    nextBtn.setOnClickListener(new View.OnClickListener() {
    String currentDateTimeString = DateFormat.getDateInstance().format(new Date());

        @Override
        public void onClick(View arg0) {

            /**
             * check if end of game
             */
            if (currentGame.isGameOver()){
                helper.insertMark(currentGame.getRight(), QuizAppActivity.number, currentDateTimeString );
                Log.e(LOG_TAG, "id value "+ userId);
                Intent i = new Intent(QuestActivity.this, TheEndActivity.class);
                startActivity(i);
                finish();
            }
            else{
                Intent i = new Intent(QuestActivity.this, QuestActivity.class);
                startActivity(i);
                finish();
            }
        }
    });

    confirmBtn.setOnClickListener(new View.OnClickListener() {
        private boolean clicked = false;

        @Override
        public void onClick(View arg0) {
            /**
             * validate a checkbox has been selected
             */

                if(!clicked){
                       clicked = true;      

                           // do your processing - one click only
                           if (!checkAnswer())                              
                                return;
                       }
                confirmBtn.setVisibility(View.INVISIBLE);
                confirmBtn.setVisibility(View.GONE);

               }


    });


}


private void setQuestions() {
    //set the question text from current question
    String question = ConvAddition.capitalise(currentQ.getQuestion()) + "?";
    TextView qText = (TextView) findViewById(R.id.question);
    qText.setText(question);

    //set the available options
    List&lt;String&gt; answers = currentQ.getQuestionOptions();
    TextView option1 = (TextView) findViewById(R.id.answer1);
    option1.setText(ConvAddition.capitalise(answers.get(0)));

    TextView option2 = (TextView) findViewById(R.id.answer2);
    option2.setText(ConvAddition.capitalise(answers.get(1)));

    TextView option3 = (TextView) findViewById(R.id.answer3);
    option3.setText(ConvAddition.capitalise(answers.get(2)));

    TextView option4 = (TextView) findViewById(R.id.answer4);
    option4.setText(ConvAddition.capitalise(answers.get(3)));
}


@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
    switch (keyCode)
    {
    case KeyEvent.KEYCODE_BACK :
        return true;
    }

    return super.onKeyDown(keyCode, event);
}


private boolean checkAnswer() {

    TextView checkAnsText = (TextView) findViewById(R.id.checkAns);

    String answer = getSelectedAnswer();
    if (answer==null){
        return false;
    }
    else {
            if (currentQ.getAnswer().equalsIgnoreCase(answer))
        {
                currentGame.incrementRightAnswers();
                checkAnsText.setText ("Correct Answer " + answer);
                Log.e("Correct Answer", answer, null);

        }
        else{
                currentGame.incrementWrongAnswers();
                checkAnsText.setText ("Wrong Answer " + answer);
                 Log.e("Wrong Answer", answer, null);

        }
        return true;
    }
}


private String getSelectedAnswer() {
    RadioButton c1 = (RadioButton)findViewById(R.id.answer1);
    RadioButton c2 = (RadioButton)findViewById(R.id.answer2);
    RadioButton c3 = (RadioButton)findViewById(R.id.answer3);
    RadioButton c4 = (RadioButton)findViewById(R.id.answer4);
    if (c1.isChecked())
    {
        return c1.getText().toString();
    }
    if (c2.isChecked())
    {
        return c2.getText().toString();
    }
    if (c3.isChecked())
    {
        return c3.getText().toString();
    }
    if (c4.isChecked())
    {
        return c4.getText().toString();
    }

    return null;
}


@Override
public void onClick(View arg0) {
    // TODO Auto-generated method stub

}}
</code></pre>
