Android Change picture every 10 seconds

前端 未结 4 591
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-24 09:14

Im trying to write a very basic android app that displays around 5 pictures one after each other on the screen. I want it to display a different picture after about 10 secon

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-24 09:19

    Create a Runnable that executes the change you want (I suppose it will be changing an ImageView's bitmap/drawable), and post them with delay to the main thread loop, using a Handler and its postDelayed() method.

    To make it a loop, you could have the runnable post itself.

提交回复
热议问题