Harsha M V Harsha M V - 1 year ago 118
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

Answer Source

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
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download