I’m currently making a basic maths application in Android.
Program will print on std output the following text: 2 + 2 = ?
User inputs a value by pressing a button and the program will then displays 2 + 2 = 4.
I got that part to work using buttons and setText but I want to have 10 different addition questions on the same activity.
My problem is that I can’t press the same button again because it simply brings up the TextView.
Do you think drawing numbers on a canvas woukd be a better approach?
public void onClick(View v) {
add = 4;
display.setText("2 + 2 =" + add);
}
You can change the activity of the button with a flag called
answeredor something to that effect. Assuming you want to cycle through your questions:This changes based on how you’re storing/generating your questions