Fixed
Status Update
Comments
lb...@gmail.com <lb...@gmail.com> #2
I've tried this on a HTC Sensation XE 4.0.3 with Lunar Lander, out the box, no modification, and I also see the same behaviour where a null canvas is incorrectly returned before the surface is destroyed. Net result, the sample game crashes when rotated.
es...@google.com <es...@google.com>
am...@google.com <am...@google.com> #3
I wasted a good amount of time tracking this down because I didn't expect it to be a bug in android itself. Is there a consensus on the workarounds suggested? Is it considered acceptable practice to catch NullPointerException (which could be thrown from other bugs in the draw method)? Also, is it safe to condition the call to the draw method on canvas being not null (i.e. is it safe to assume there no chance that it will become null in the middle of the draw method)?
Description
Android Studio 3.5
Build #AI-191.8026.42.35.5791312, built on August 9, 2019
JRE: 1.8.0_202-release-1483-b03 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
Libraries used:
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0-alpha09'
The rendering of MaterialCardView on the IDE doesn't have shadow and lets the content reach outside of its bounds.
See attached screenshot and sample project.