In this tutorial, I will show how to increase and decrease the integer value when the button is clicked. Here, the default value is 0 and when you click the plus button the integer value is increased by one and when you click the negative button the integer value is decrease by one.
Android Example: How to Make Increase and Decrease the Integer Value When the Button is Clicked
XML Layout File
Following is the XML layout file with a TextView and two Buttons for plus and minus.
Java Activity File
Following is the final java code of MainActivity.java file.
Now, run your application and click plus and minus buttons.