subject: View Widgets Provided By Android For Standard Functionality Are Often Extended To Customize Them [print this page] Android application development needs from Android developers that they precisely recognize what are the graphical demands of the application they are forming. There are many ways to complete graphical work. The method to carry out graphics and animations for a static app is very distinct as compared with employing graphics plus animations for an interactive game. Let's take a look at some alternatives for drawing graphics on Android plus tasks those graphics perform the best.
There's a collection of View widgets offered by Android. This set is supplied chiefly for common usefulness of the extensive range of User Interfaces. These widgets can also be expanded by the Android developers anytime they want to alter the way these widgets appear or behave. Android application development offers freedom to the developers to conduct their own custom 2D rendering and that is accomplished by using drawing methods which are involved in Canvas class. Drawable objects for things like textured keys or even frame-by-frame animations can additionally be built by Android application developers. Android 3.0 is competent of giving hardware acceleration to the majority of the drawing created by the Canvas APIs with which their efficiency can certainly be advanced.
Android with the help of Android framework APIs and Native Development Kit (NDK) facilitates OpenGL ES 1.0 and 2.0. Use of the framework APIs is suggested in two cases. Initially, any time Android developers wish to include a several graphical improvements to the app which are not reinforced with the Canvas APIs. Next, in situation developers want platform independence and do not anticipate high results.
Still, with regard to numerous graphic intensive applications such as games, use of the NDK is advantageous over the use of framework APIs. But, a few applications like Google Body application which are developed entirely with the framework APIs perform very well even with the application of framework APIs. In case the developers have a lot of native code that they need to port over to Android, OpenGL along with the NDK is additionally advantageous.
Android developers get two techniques of drawing 2D graphics with a collection 2D drawing APIs. To draw graphics as well as animations into a View object from layout is the very first technique. In this way, the developer needs only to specify the graphics to go within the View and the drawing of your graphics is addressed by the system's normal View hierarchy drawing process.
Secondly, developers can draw the graphics straight to a Canvas. This will make the developers invoke the suitable class's onDraw() method - passing it Canvas, or one of the Canvas draw...() methods like drawPicture(). Like this, developers furthermore get into the command of any kind of animation.
In Android development London, if developers want to draw simple graphics that do not alter dynamically as well as are not element of a performance-intensive game, drawing to a View can prove to be the best choice. If Android developers choose to demonstrate a static graphic and also predetermined animation inside an not static application, they are able to draw the graphics into a View.
Drawing to Canvas is ideal when app is required to regularly re-draw itself. Applications for instance video games ought to be drawn to the Canvas on its own. In the same thread, as element of UI Activity, developers can create a custom View element in layout, call invalidate() as well as afterward handle the onDraw() callback. The developers don't have to demand invalidate() in a separate thread as they deal with a Surface View as well as carry out draws to the Canvas in accordance with speed of the thread.