HDTutorial
EN

Playback starts YouTube’s embedded player (privacy-enhanced mode).

OnClickListener for Multiple Buttons - Android Studio Tutorial

317,368 views October 26, 2018 3:32

Watch on YouTube
ChannelCoding in Flow

Description from the creator

In this video we will learn, how to set OnClickListeners for multiple buttons and handle them all in one onClick method. Instead of passing an anonymous inner class to the setOnClickListener method, we will pass the activity itself and implement the OnClickListener interface into our MainActivity. We will then use a switch/case statement to check for the button IDs and handle the corresponding button click.

Source code:
gist.github.com/codinginflow/aaf70b851bf644e4f7…

____________________
💻 Find the BEST programming tutorials on TutHub:
tuthub.io

⭐ Get my MVVM Caching Course now:
codinginflow.com/caching

❗ Subscribe to the channel:
youtube.com/c/codinginflo...

📨 Subscribe to the Coding in Flow newsletter:
codinginflow.com/newsletter

❓ Join our free developer community:
discord.gg/TSnMvmc

📣 Follow Coding in Flow on other sites:
Facebook: facebook.com/codinginflow
Instagram: instagram.com/codinginflow
TikTok: tiktok.com/@codinginflow
Twitter: twitter.com/codinginflow
Github: github.com/codinginflow

💰 Business requests, sponsoring, etc.: [email protected]

About this tutorial

Coding in Flow published this 3:32 video tutorial on October 26, 2018. It has been watched 317,368 times on YouTube.

Duration
3:32
Published
October 26, 2018
Views
317,368
Likes
3,668

Tags

Share

Further reading

  • Android : Multiple Button One Listener androidlearner.com

    Simple Calculator in Android (Xamarin) using VisualStudio C# In Brief: This article will help you on building a simple calculator in android Xamarin with simple steps using C# Language in Visual Studio . Detail: Buildin…

  • Multiple Buttons OnClickListener() - Android androidacademic.blogspot.com

    Android - Setting onClickListener for Multiple Buttons It is very basic practice to implement onClickListener() for more than one views. But making it easier to implement and handle is different task.

  • OnClickListener for Multiple Buttons - Coding in Flow codinginflow.com

    In this video we will learn, how to set OnClickListeners for multiple buttons and handle them all in one onClick method. Instead of passing an anonymous inner class to the setOnClickListener method, we will pass the act…

This tutorial in other languages