The function for onClick
attribute in XML has to be something like,
public void yourFunction (View view) {
//Your code
}
Since you didn’t add View
as the argument of your function, your layout is never going to get to it, hence when you click on your button, the app crashes.
You also need to create an counter to count which index are you at, make it something like, a member variable int count=0;
and on every next question make it count++;
and on every previous question make it count--;
1
solved how to get strings from a string array and show it one by one in a TexttView using Buttons (android)