Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

making image clickable

 
Paul Ngom
Ranch Hand
Posts: 355
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I have an image that i load from a remote server using


and i would like to make it clickable so that i can start another activity. Could you please give me steps as of how i could achieve this?
Kind regards.




 
Chris Barrett
Bartender
Posts: 317
24
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,

Check out the ImageButton class (which is extended from ImageView).
For more information, please review: http://developer.android.com/reference/android/widget/ImageButton.html

Cheers!
Chris
 
Paul Ngom
Ranch Hand
Posts: 355
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christ,
I have visited the link you provided but I cannot still see how I could adapt it to my case.
Thank you for your reply.


 
ibrahim yener
Ranch Hand
Posts: 202
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume you have ImageView not ImageButton

First of all open your layout xml file, find "clickable" checkbox in property menu at right side of your ADT screen.
Once you found it click it and put a check mark.
Then right below of it you will see "onClick" property type method name in there and hit ENTER. (Let's say you typed clickImage)

In your activity class file create following method.

public void clickImage(View v)
{
// Your code goes here
}
 
Paul Ngom
Ranch Hand
Posts: 355
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much Ibrahim. That was exactly what i was looking for.
Good day!



 
ibrahim yener
Ranch Hand
Posts: 202
Android Java PHP
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are welcome.

Glad to help
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic