Android three ways to set click listener

In Android we can set click listener by three ways

  1. Setting individual click listener for each element.
  2. Implementing OnClickListener in activity level.
  3. Creating a separate function for handling button click and add this function in xml


In the above example btn_three I have added a property android:onClick=”myBtnClick” myBtnClick is a function I have defined in activiy


Author: bm on July 22, 2016
Category: Android
Tags: , ,

Your comment:

Your Name


Last articles