Android Progress Dialog
I have a WidgetProvider which is around for milliseconds. It takes in an intent, and it kicks off a service which takes maybe noticeable time. I wanted to display something to the user during this delay like a progress bar that will block user, but the BroadcastReceiver/WidgetProvider seems like the wrong place to start up a progress bar. Where should I issue the P开发者_运维知识库rogress Bar in this case? Service maybe? but service might not be part of UI at all?
Where should I issue the Progress Bar in this case?
From a UI perspective, your only choice is to have it in the app widget itself. ProgressBar is one of the valid widgets to have in an app widget layout.
In terms of who updates the RemoteViews
of your app widget to display/update/remove the ProgressBar
, that is probably your Service
in whatever background thread you are using for the "noticeable time".
Have you tried putting a progress bar in the notifications pull down? Doing something like the market displays when you're downloading an app should work really well, and execute in the background well.
Use can use AsynTask to display progress bar.
精彩评论