How to Increase the Integer Value When Button is Clicked
http://www.viralandroid.com/2015/10/how-to-increase-integer-value-when-button-is-clicked.html
In this tutorial, I will show how to increase the integer value on the click of a button. The default value I have mentioned is 0 and when you click the plus button the integer value is increased by 1.
Related:
How to Increase the Integer Value When Screen is Touched
How to Check Internet Connection Programmatically in Android
Android Material Design with Design Support Library
XML Layout File
Create a XML Layout with a TextView and a Button.
res/layout/activity_main.xml
Java Activity File
Following is the final code of MainActivity.java file.
src/ MainActivity.java
Now, run your application and click the increase button.
Output:
Related:
How to Increase the Integer Value When Screen is Touched
How to Check Internet Connection Programmatically in Android
Android Material Design with Design Support Library
XML Layout File
Create a XML Layout with a TextView and a Button.
res/layout/activity_main.xml
Java Activity File
Following is the final code of MainActivity.java file.
src/ MainActivity.java
Now, run your application and click the increase button.
Output: