>> I have read from many sources that findViewById() is a "costly" operation.
>
> What sources?
Actually, it's described in several places as being costly, such as
the books from some "commons guy". I suspect the source material for
this was some recommendations from Romain Guy in 2008. He
re-emphasized the point in his 2010 Google I|O presentation.
However, the only places I have seen it described as costly are in the
context of a ListView, where you could easily need to do a thousand of
the calls in a fairly short time period. For something like a button
click, I wouldn't worry about caching them necessarily.
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy
_Android Programming Tutorials_ Version 2.9 Available!
--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment