android substuting the click with a timer

前端 未结 2 849
我在风中等你
我在风中等你 2021-01-24 14:33

I found this example and i have a small question: How can I remove the on click to a timer or a delay where it displays the first image and waits a couple of seconds then moves

2条回答
  •  情话喂你
    2021-01-24 15:26

    Since blocking the UI thread is fundamentally against the Android framework, what you'd probably have to do is set up a Thread and Handler to sleep on another thread in a loop and use the Handler to pass messages back to the UI Thread and change the image. I know I had a good Thread/Handler example around here somewhere...

    Ah yes... have a look at the example on how to update a ProgressDialog through a Thread and Handler. It should give you some ideas.

    http://developer.android.com/guide/topics/ui/dialogs.html#ProgressDialog

    (see the expandable section "Example ProgressDialog with a second thread."

提交回复
热议问题