Online Tutorials & Training Materials |
Register Login

Click Counter Android Application

|| || 1

Click Counter Android Application

How to Create a Full-Screen Click Counter App in Android

This tutorial explains step by step how to create a counter app in Android which changes the text of counting on each click.

Please follow the steps below in order to create a counter app in Android:

1.Click on large text and drag it to the center of the screen.

2.Click on button and drag it to the center of the screen.

3.Change the text to ‘0’ and the id to ‘tx’.

4.Add the name of the button as ‘Click Me’.

5.Change the text size – android:textsize=”100sp”.

6.Go to Add the following lines –

private int mCounter = 0;

Button btn;

TextView txv

7.Add the button and the text view.

  • btn = (Button) findViewById (;
  • txv = (TextView) findViewById (;

8.Add the OnClickListener and the mCounter value.

9.Go to activity_main.xml and add a background color. Also, change the color of the text into white.

10.Change the color of the text, background and the size of the text for the button.

11.Go to live view to check the result. Click on the application.

12.As you click on the button, it will show the count corresponding to the number of times you click on the button.



  • 03 Aug 2017 4:55 pm

    All of the options you have provided here are simply amazing I like most of them thanks for your great share, please keep sharing. 

Related Articles