问题
I wanted to display a progress bar in an appwidget that displays playback progress from a background service. I know the appwidget supports that control, but I am wondering how I might go about updating the progress bar in a way that is consistent with good widget design (e.g. low battery consumption). The way I would normally do it in an activity would be by polling the playback on a timer. I haven't implemented this yet, so I am not even sure if it would work in an appwidget. Anyone know better than me?
回答1:
Have the service update the app widget's RemoteViews
when sufficient time has elapsed to make it worthwhile to update.
来源:https://stackoverflow.com/questions/4946814/progress-bar-in-appwidget-for-a-playback-service