Reproduced from the "Black Rice GameDev Block" original link: http://www.himigame.com/android-game/296.html
☞ Click to subscribe to the latest news blog ☜! Keep the latest blog posts in time to inform you.
———————————————————————
"A lot of child shoes say that my code runs after the click Home or back after the program is abnormal, if you have encountered, then you certainly did not carefully read Himi blog post, 19th Himi specifically wrote about the causes of these errors and solutions, here I added to the blog, Provincial children's shoes are always puzzled this piece; Please click the link below to enter the reading:
"Android Game development 19" (Must see article) Surfaceview Operation mechanism detailed analysis-Analyze back and home button and cut into the background, such as exception handling. 』
——————————————————————-
Children's Shoes Please note: Surfaceview There is indeed OnDraw this method, but you surfaceview not to call yourself ...
The OnDraw () in my Code or draw () is a method I have defined ... Put on the line in the continuous call, be sure to pay attention to.
Before we made a comparison and choice of view and Surfaceview, finally we found that surfaceview more suitable for the operation and game development, then let us take a look at the structure of the surfaceview it;
First a code: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27-28 29 30 31 32 33 34 35 36 37 42 43 44