The main class of Android game development is display class except control class, and it is very important and complicated to display and game logic processing. Display and canvas can be implemented in J2ME, and the view class is displayed in Android. Here is a brief introduction to Android.view.View and Android.view.SurfaceView.
Surfaceview is a display class derived from the view base class, and the direct subclass has Glsurfaceview and Videoview to see how the GL and video playback and camera cameras generally use surfaceview, what are the advantages? Surfaceview can control the surface of the format, such as size, display in the screen position, the most critical is to provide the Surfaceholder class, using the Getholder method to obtain, related to Canvas Lockcanvas (), Canvas Lockcanvas (Rect dirty), void Removecallback (Surfaceholder.callback Callback), void Unlockcanvasandpost (Canvas Canvas) Control graphics and drawing, and in the Surfaceholder.callback interface callback you can define specific implementations (such as the first change format and display screen) by following three abstract classes:
abstract void surfacechanged (surfaceholder holder, int format, int width, int height);
abstract void surfacecreated (Surfaceholder holder);
abstract void surfacedestroyed (Surfaceholder holder);
For surface-related, the Android bottom also provides GPU acceleration, so the main use of surfaceview in real time applications is not directly built from view, The Glsurfaceview in OpenGL, which is also mentioned later, is implemented from this class.
Above on the Android view class and surface details, I hope to help Android development friends, thank you for your support to the site, follow-up to continue to supplement the relevant information.