{"id":1408,"date":"2020-04-13T02:06:35","date_gmt":"2020-04-13T02:06:35","guid":{"rendered":"http:\/\/sdi.thoughtstorms.info\/?p=1408"},"modified":"2020-04-13T02:06:35","modified_gmt":"2020-04-13T02:06:35","slug":"android-extended-surfaceviews-ondraw-method-never-called","status":"publish","type":"post","link":"https:\/\/sdi.thoughtstorms.info\/?p=1408","title":{"rendered":"Android : Extended SurfaceView&#039;s onDraw() method never called"},"content":{"rendered":"<p>This has just resolved something I&#8217;ve been beating my head against the wall over for the last several days.<br \/>\nSource: <em><a href=\"https:\/\/stackoverflow.com\/questions\/2687015\/extended-surfaceviews-ondraw-method-never-called\">android &#8211; Extended SurfaceView&#8217;s onDraw() method never called &#8211; Stack Overflow<\/a><\/em><br \/>\nWHY? Android?<br \/>\nWhy are you so convoluted and perverse?<br \/>\nSo &#8230; yeah &#8230; subclass the SurfaceView class &#8230; and you&#8217;d expect to be able to custom draw by over-riding its onDraw method, right?<br \/>\nI mean, that&#8217;s not an unreasonable assumption to make.<br \/>\nTurns out &#8230; no. You have to do some weird black magic. Because by default the onDraw isn&#8217;t called for &#8220;efficiency&#8221; reasons.&nbsp; The StackOverflow answer sort of explains. But doesn&#8217;t really.<br \/>\nWhy is Android so convoluted and perverse? Why isn&#8217;t there a better API to this?<\/p>\n<hr \/>\n<p>PS : please take care and stay safe in this time of COVID19. I&#8217;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&#8217;s that simple.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This has just resolved something I&#8217;ve been beating my head against the wall over for the last several days. Source: android &#8211; Extended SurfaceView&#8217;s onDraw() method never called &#8211; Stack Overflow WHY? Android? Why are you so convoluted and perverse? So &#8230; yeah &#8230; subclass the SurfaceView class &#8230; and you&#8217;d expect to be able [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[19],"class_list":["post-1408","post","type-post","status-publish","format-standard","hentry","category-opinion","tag-android"],"_links":{"self":[{"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=\/wp\/v2\/posts\/1408","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1408"}],"version-history":[{"count":0,"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=\/wp\/v2\/posts\/1408\/revisions"}],"wp:attachment":[{"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1408"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1408"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}