<@U3LG5J7UL>: Under the hood, it just uses a `Spar...
# android
d
@f.babic: Under the hood, it just uses a
SparseArray
to cache the views. When you reference
my_view
, it compiles to a call to a synthetic function,
_$_findCachedViewById
, which checks the sparsearray if the ID is already in the mapping... if so, it returns the view. Otherwise, it calls
findViewById
, adds the view to the cache, and returns the view. You can clear the cache with
clearFindViewByIdCache()