EF's Blog

Android Tutorial : Put Action (Intent) Listener on ImageView to Open URL (Browser)

Posted on: May 10, 2012

ImageView imgKantorPemasaran = (ImageView)findViewById(R.id.imgKantorPemasaran);
imgKantorPemasaran.setOnClickListener(new OnClickListener(){
public void onClick(View view) {

//the action supposed to be placed here

final Intent urlAddress = new Intent(Intent.ACTION_VIEW);
urlAddress.setData(Uri.parse(“http://www.thevanessasbridal.com”));
startActivity(urlAddress);
}});

 

dont forget to add this to android manifest

<uses-permission android:name=”android.permission.INTERNET”></uses-permission>
<uses-permission android:name=”android.permission.ACCESS_NETWORK_STATE”></uses-permission>

3 Responses to "Android Tutorial : Put Action (Intent) Listener on ImageView to Open URL (Browser)"

Can you provide a working project example to study it?

it is actually working. just create an imageview with id imgKantorPemasaran at layout.

in the mainactivity.class, you can just add the code above, and add this to your android manifest :

Ok, thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

EF’s Blog

I'm just ordinary people who lived in an extra-ordinary world.

EF's Blog Stats

  • 126,562 hits
May 2012
M T W T F S S
« Apr   Jul »
 123456
78910111213
14151617181920
21222324252627
28293031  

Archives

%d bloggers like this: