Android : Extended SurfaceView's onDraw() method never called

This has just resolved something I’ve been beating my head against the wall over for the last several days.
Source: android – Extended SurfaceView’s onDraw() method never called – Stack Overflow
WHY? Android?
Why are you so convoluted and perverse?
So … yeah … subclass the SurfaceView class … and you’d expect to be able to custom draw by over-riding its onDraw method, right?
I mean, that’s not an unreasonable assumption to make.
Turns out … no. You have to do some weird black magic. Because by default the onDraw isn’t called for “efficiency” reasons.  The StackOverflow answer sort of explains. But doesn’t really.
Why is Android so convoluted and perverse? Why isn’t there a better API to this?


PS : please take care and stay safe in this time of COVID19. I’m self isolating as far as possible. And I recommend you do too. The more we can slow its spread, the fewer people will die. It’s that simple.

Leave a comment