• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

making image clickable

 
Ranch Hand
Posts: 355
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.




 
Bartender
Posts: 322
24
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.


 
Ranch Hand
Posts: 202
Android PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 PHP Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are welcome.

Glad to help
 
reply
    Bookmark Topic Watch Topic
  • New Topic