• 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

can anyone tell me how pass valueon onclick parameter in android .. i m new to programming ...

 
Greenhorn
Posts: 12
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Ranch Hand
Posts: 570
3
Android Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To pass value , you probably need Intent
 
Saloon Keeper
Posts: 7582
176
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think an Intent is the solution, but it's hard to tell because the code contains no onClick method. Which value do you want to pass from where to where?
 
Ranch Hand
Posts: 49
1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use OnClickListener and then use intent on this method

 
Mike Hussey
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Want to change the ImageView's picture at runtime dynamically, after 1 sec, 3 sec and 5 sec. but i don't how to pass a vlaue in onClickListener.
 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are all sorts of weird and wonderful things about that code; the loop in lines 20‑30 looks very peculiar, almost certainly incorrect.
Why are you calling Thread#sleep? I don't know enough Android, but why can't you use a timer and a timer task object instead?
Why have you got public fields? Why are you using one‑letter indentifiers? Does anybody know what R means?
 
Tim Moores
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Does anybody know what R means?


Actually, anyone doing Android programming does - it's part of the API.
 
Tim Moores
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mike Hussey wrote:Want to change the ImageView's picture at runtime dynamically, after 1 sec, 3 sec and 5 sec. but i don't how to pass a vlaue in onClickListener.


That doesn't answer the question of which value you want to pass from where to where.
 
Campbell Ritchie
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hadn't noticed you are new here. Sorry: welcome to the Ranch
reply
    Bookmark Topic Watch Topic
  • New Topic