I am having a problem in looping/adding the score. What I have here is only a method/equation for adding the score. Can anyone help me loop this? What I mean is that when a button is clicked, the corresponding score in the database should add. Example, I have an apple which is equivalent to 1 and a condense milk which is equivalent to 5, this should automatically sum up to 6(same process as i add more fruits). So this is what I mean in loop in score.

I also have a timer and what I want is that when the time is over, the sum or total should also automatically save into the database.

Can anyone help me about this matter?

Formula I use for addition

private void calculate(){
		x = Integer.parseInt(tv3.getText().toString().replaceAll("\\s",""));
	    y = Integer.parseInt(tv2.getText().toString().replaceAll("\\s",""));
	    z = x + y;
	    score.setText(Integer.toString(z));
	    }

Related posts

Recent Viewed