Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make an image clickable

Tags:

android

I'm kind of new to this whole thing so I need some help. I have an application that creates an ImageView OnCreate. I want to make this image clickable and have it open a browser to a specific link.

How would I do this? I'm having trouble specifically with the setOnClickListener because the parameters are not accepting an OnClickListener.

I'm developing for Android 1.6

like image 393
retnuh Avatar asked Aug 09 '10 19:08

retnuh


1 Answers

You shoud set ImageView property clickable to true. Then set listener:

mImageView.setOnClickListener(new View.OnClickListener() {

  @Override
  public void onClick(View view) {
    // do stuff
  }

});
like image 97
Rabas Avatar answered Sep 30 '22 16:09

Rabas