posted 3 years ago
How do you expect the onClick() method to get called? Did you assign the MainActivity as an OnClickListener to something? If so, where? What lines of code get called? Have you run the application in debug mode? You can put a break statement in on the first line of the onClick() method then step through the method to see what lines get called and to see what the values of the variables are, so you can see why a particular path was taken. If you don't know how to do that, then you can use Log statements to determine what lines get executed and the values of variables.