General discussion
February 19, 2013 at 08:31 PM
os2baba

Just a nit

by os2baba . Updated 13 years, 6 months ago

As I have been working along through the series, I have been writing the code instead of just importing the project since I find I learn better as I type it in. One thing that I have done is created an instance variable for the Gameboard in the onCreate method and using the instance attribute instead of typing in
(GameBoard)findViewById(R.id.the_canvas)
everywhere. Apart from improving readability, this should also improve performance since it’s not traversing the view hierarchy so many times to locate the view. Although the view hierarchy is very small in this case, we are doing it multiple times and every time we update the frame.

This discussion is locked

All Comments