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:
<ImageView
android:id=”@+id/my_button”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_gravity=”center_horizontal”
android:src=”@drawable/logo”/>
Then set up a listener for the “on click” in your code:
ImageView img = (ImageView) findViewById(R.id.my_button);
img.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// open the desired page
Intent browserIntent = new Intent(“android.intent.action.VIEW”,
Uri.parse(“http://www.gonzobrains.com”));
startActivity(browserIntent);
}
});
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