On Sat, Jun 5, 2010 at 11:09 PM, James W <[email protected]> wrote:
> Mark, regarding the battery comment, could you or someone elaborate? I > have heard this countless times but with no justification. Is there > something intrinsically inefficient about updating an appwidget with > RemoteViews, more so than some other operation? > > For example, if I am trying to "fake" a 5 second widget animation by > frequent updating an imageview over 5 seconds using RemoteViews, does > that consume more battery than doing a similar operation on a > imageview in an Activity? > > Or is it more the assumption that such animations would be playing > permanently, which would not be best practice and I could see of > course would drain the battery? > Both. If your widget is updating every 5 seconds... well, you are running your code every 5 seconds the entire time the device is able to run, which is going to kill the battery. It doesn't matter if you were doing this in your own process or elsewhere. Also RemoteViews is not a negligible. There is nothing intrinsically inefficient about it compared to other things... but building a view hierarchy and updating it is not close to a 0-cost thing. And there is the additional overhead of the work you do needing to be communicated to the system, and then to the home screen, where it needs to execute your UI operations (worse case having to re-inflate and build your view hierarchy). -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

