Wait a minute before downloading - JavaMe
I want to wait one minute before downloading from server using h开发者_如何学Pythonttpconnection. What can I use in order for the program to stop for one minute?
Do not call sleep
to pause a thread. You would likely be pausing the event thread, which could cause your app (and possibly the phone itself) to appear to lock up for a minute.
Best thing to do is set a timer using java.util.Timer and have it wait for 60 seconds before doing the HTTP connection. You'll need to do the latter in a separate thread anyhow, so it's not a big deal to have that thread triggered off a timer.
精彩评论