Create Simple Click Counter Android Application

Here, we can see now how to create a simple Click Counting Android Application. This Application will count your number of clicks and show the number of times in an app screen.
  • Android Studio 2.3.3.
  • Android device for Deployment Purpose (optional).
Now, we can create Click Counter Application. You should follow the steps given below.
Step 1
Run an Android Studio and click Start a new Android Project. Now, you will see the development Window.
To view the design page, click>project>app>resource>layout>activity_main.xml.
Step 2
To add button in design page, click >palette>click button to drag into the design screen.
Double click the button, and the properties Window opens to change the button name Textview>button rename into Click Me.
Step 3
Here, we add Textview in design page to select>palette> click Textview to drag into the mobile screen.
Double click the Textview; the properties Window opens to change text name >set name as a “no of clicks” and ID txt1 then set textsize“30sp”.
Step 4
Go to >activity_main.xml>button codes>at the last choice for our customized onclick event. Now select the bulb icon, which shows click. It gives some suggestions to select the create “onclick[view] in MainActivity”option in the list.
Now, the button method and view library files will import into the page.
Step 5
Here, we add the variable int count=0; start with 0 time and go to onclick event add a piece of code inside the onclick event.
We use textview function in an event code and it will automatically generate textview library files in for the reference purpose.
Onclick button code
public void onClick(View view)
count++;//increment the count
TextView text=(TextView)findViewById(;// resorce location
text.setText("No.of Clicks "+count);// view in the text
After completing the coding part to deploy, (run) the click counter Application
Step 6
Now, the click counter app will deploy into an Android device because an Android Virtual Device wants to have more than 1 GB RAM high configuration machines, which creates no problem for deployment but low configuration machines are not working properly, so we need to use Android devices.
You also use your own Android devices for the deployment to enable the developer mode in your mobile and connect your devices into machine and run the Application.
Here, I am using My ASUS device for the deployment use.
Click counter Application, which needs to be run in an Android device.
After deployment completes, click the Click Me button and you will see the no. of click counts in your Android device.