android - onDraw() efficient design for a custom view -



android - onDraw() efficient design for a custom view -

i have custom view represents simple gameboard several tiles. have 2-d array stores displayed image (0 no image) tile.

currently within ondraw() method loop through array , display images tiles. time invoke invalidate() without args when reset board. in other places invoke invalidate(rect) required tile needs updated.

is above implementation of ondraw() in-efficiently drawing view? if improve way this? (also invoking invalidate(rect) guarantee updating 'rect' part or recommendation android may ignored?).

appreciate clarifications this.

is above implementation of ondraw() in-efficiently drawing view?

it enough. otherwise you'd larn opengl create utilize of hardware acceleration in drawings, of depends on if tiles changing every frame or how many tiles have.

also invoking invalidate(rect) guarantee updating 'rect' part or recommendation android may ignored?

it updates rect area, infact romain guy uses invalidate(rect) default home launcher application in order not update whole screen everytime home screen needs update.

android

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -