Detailed analysis of Surfaceview! Callback and surfaceholder!! _ Game Development

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.