• 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
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

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
 
Bartender
Posts: 7488
171
  • 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
 
Arthur, where are your pants? Check under this tiny ad.
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic