• 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

how to change the image dynamically in android by using timer or after 1 sec and 3 sec and 5 sec

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone help me
 
Saloon Keeper
Posts: 7590
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you have so far, and where are you stuck making progress? There are numerous libraries out there that display image slideshows; I'm sure they allow you to vary the time between transitions.
 
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

but i want to do in timer can you help me
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Set up a Timer to run a TimerTask every 3 seconds. The TimerTask only has to call the button's setText method to change the button's text. You would have to do this within the UI thread, so you should use post to run a Runnable object that will perform the update an the correct thread.
you can try this:-
AnimationDrawable animation = new AnimationDrawable();
   animation.addFrame(getResources().getDrawable(R.drawable.image1), 100);
   animation.addFrame(getResources().getDrawable(R.drawable.image2), 500);
   animation.addFrame(getResources().getDrawable(R.drawable.image3), 300);
   animation.setOneShot(false);

   ImageView imageAnim =  (ImageView) findViewById(R.id.img);
   imageAnim.setBackgroundDrawable(animation);

   // start the animation!
   animation.start()
Thanks and Regard
Shujat khan
reply
    Bookmark Topic Watch Topic
  • New Topic