I was reading this tutorial on how to use a custom surface view class in an XML layout and when I ran the code, the app crashed when my phone's orientation changed. I've noticed a
Solution 1:
move this line of code:
thread = newMySurfaceThread(getHolder(), this);
from the init() method in MySurfaceView, to the surfaceCreated() method.
When shifting orientation, the onCreate methods are recalled, but the constructor of MySurfaceView won't be called, since it is retained.
Hope this helps :)
Share
Post a Comment
for "Android: Custom Surface View Crashing Upon Orientation Change"
Post a Comment for "Android: Custom Surface View Crashing Upon Orientation Change"