Harsha M V Harsha M V - 8 months ago 57
Android Question

android how to write click event of an ImageView

I have an alarm symbol on my interface. I want it like if anyone clicks on this then he/she can get another interface.
so how to write a click event of Imageview. plz give me answer. Thank you


You can add an OnClickListener to ImageView using setOnClickListener method on your ImageView and write your code in the listener's onClick method.

OnClickListener clickListener = new OnClickListener() {
    public void onClick(View v) {
               if (v.equals(imageView)) {
                  // Write your awesome code here