tags:

views:

56

answers:

2

is it possible to make an imageview link to a web page such that when user taps on the image, it takes them to a web page?

A: 

That's truly possible, at onClick handler you need to start an activity with intent specifying the uri. See http://stackoverflow.com/questions/3505788/how-to-open-default-browser/3505804#3505804 for example.

Konstantin Burov
+1  A: 

Just add a click listener to the image to open an URL:

ImageView img = (ImageView)findViewById(R.id.foo_bar);
img.setOnClickListener(new View.OnClickListener(){
    public void onClick(View v){
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_VIEW);
        intent.addCategory(Intent.CATEGORY_BROWSABLE);
        intent.setData(Uri.parse("http://casidiablo.net"));
        startActivity(intent);
    }
});
Cristian
thanks that answered it. I am new here. How do I mark this question as answered?
Dean-O