Is it good to call findViewById every time in Activity lifecycle whenever required?

前端 未结 6 1144
余生分开走
余生分开走 2020-12-20 13:56

Whenever we need a reference to the widget, we uses findByViewById.

When we are referring the widget lots of time in the code of the same Activity class, we can fol

6条回答
  •  眼角桃花
    2020-12-20 14:15

    Accessing a member variable is always faster than any function call. The used space for that variable is insignificant. By the way: The code looks much cleaner!

提交回复
热议问题