Loading...

How to Increase the Integer Value When Button is Clicked

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:
How to Increase the Integer Value When Button is Clicked in Android

Tutorial 228466418340423444
Home item