[Solved] I want to reduce the code in Android


Are all the buttons currently in the same class? Because if so, you can just make a method that does the work, and call it for each button, passing as method arguments any variables that change from button to button. If not, you can still make a method, but you’ll just have to make it public and place it in a class that all the others have access to.

And user1071777’s comment about using arrays (e.g. int[] xd = int[10]) instead of many discrete variables is spot-on as well. Then you can run a for loop (for( int i=0; i<10; i++ )) where you test whether xd[i] == yd[i].

solved I want to reduce the code in Android