Hi Dianne, I think you misunderstood my 5 seconds comment. I was not talking about an widget that updated its view every 5 seconds, i.e. an update at 0, 5, 10, 15 etc.
I was postulating a widget that in response to a trigger, say a click by the user, ran an animation for 5 seconds, by changing the imageview bitmap every tenth of a second or so. So, say 50 updates in that short space of time. >From my position of ignorance that didn't seem it should be more intensive than doing a similar thing in an activity, and hence shouldnt drain the battery any quicker than that. But I guess the second part of your response still holds, there is more of a overhead due to the whole remote views thing and the interprocess communication that requires, which the Activity wouldnt have. Regards James On Jun 6, 3:10 pm, Dianne Hackborn <hack...@android.com> wrote: > On Sat, Jun 5, 2010 at 11:09 PM, James W <jpbwebs...@gmail.com> 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 > hack...@android.com > > 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en