Android – How to make clickable image open a web page

It’s very easily to allow a user to touch an image and cause the touch event to open a web page:

First, at the image to your main.xml file:







Then set up a listener for the “on click” in your code:

ImageView img = (ImageView) findViewById(;

img.setOnClickListener(new OnClickListener() {

public void onClick(View v) {

// open the desired page

Intent browserIntent = new Intent(“android.intent.action.VIEW”,





One thought on “Android – How to make clickable image open a web page

  1. I don’t know who you are. Thanks a lot! The tut works now! Also, do mention the Import files needed. I searched a lot to find those.

    Cheers :)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>