android graphics and animations interview questions and answers - skillgun
How to implement a snake game in android? What kind of view has to be used for this implementation?
You can use ImageView
Use Custome View and draw directly on Canvas
Use existing predefined views and draw directly on canvas
If you want to draw some images which will not have particular x,y co-ordinates and which moves randomly in the screen, then you can't do it with android predefined views. Better directly draw on canvas by creating custom views. Once canvas is under your control, then you can move your images randomly (as snake moves randomly) on the screen.
What is tween animation in android?
animating an image which is at a fixed location, like scaling, rotating, and alpha is called as tween animation.
switch between two images using image switcher is called as tween animation
playing frame after frame using animation-list xml property is called as tween animation.
all of the above are examples of tween animation.
animating an image which is at a fixed location. Animating a single image with a series of transformations is tween animation.
There are 3 tween animation techniques.
1. scaling : Zooming in and Zooming out effect
2. rotating : Rotating a view clock wise or anti clock wise
3. alpha : making a view transparent or visible.
what is frame animation in android?
animating an image which is at a fixed location, like scaling, rotating, and alpha is called as frame animation.
switch between two images using image switcher is called as frame animation
playing frame after frame using animation-list xml property is called as frame animation.
all of the above are examples of frame animation.
playing image frame after image frame using animation-list xml property is called as frame animation.
Note : If you play 24 frames in a second, it will become a movie.
Tween animation will be animated only by using one image frame, where as frame animation requires multiple image frames to animate. That is the main difference.
Tween animation is part of which package?
it is part of android.graphics.drawable package
it is part of view package.
it is part of 3D graphics library (open GLES).
it is part of kernel.
tween animation is applicable to all views, so it is part of view package.
To achieve frame animation we use AnimationDrawable class. In which package it is located?
FrameAnimation is part of android.graphics.drawable package
How to draw directly on canvas of android UI?
Implement your own custom View by extending View class, and then implement onDraw method in it.
Take any UI control like ImageView, and draw image using canvas.
it is not possible to directly touch Canvas.
both option 1 and 2 are right.
Directly drawing on Canvas can be done by creating custom views by extending view class. Where we can draw directly on canvas.
I am creating a game where a snake will be moving dynamically based on the user key directions, then how should I implement this snake image in my activity?
Use image view and put a snake image in that view, and move the view based on user key movements.
Use frame animation with multiple snake images on the same image view.
Use custom view, where you can draw your own shapes dynamically on canvas.
we can use any of the above 3 options for this requirement.
developing a snake game needs to redraw snake image very randomly and dynamically. also snake size may keeps increasing, so its better to take complete control over canvas and draw on it using a custom view.
What is the most feasible image format that I have to use with android devices. (Keep compatibility issues in mind)?
.jpg, or .jpeg.
9 patch image is the suggestible image to use, because it has the capability of scaling and padding automatically based on the screen size.
What is the tool to convert images to 9 patch image? where it will be located?
draw9patch is the tool name, it is located in android-sdk/platform-tools.
draw9patch is the tool name, it is located in android-sdk/tools.
9patch is the tool name, it is located in android-sdk/platform-tools.
9patch is the tool name, it is located in android-sdk/tools.
draw9patch.bat is the tool name used to convert images to 9 patch images.
It is located in android-sdk/tools folder.
What is the use of 9 patch image compared to other images?
It will scale the images automatically based on the device screen sizes on which app is loaded.
it will make the images smaller in size compared to other png images.
it is used for security purpose for the images used in the project.
all of the above options are true.
what are the tags used in tween animation?
all of the above.
tween animation has scale, alpha, and rotate tags.
If programmer don't know c/c++ and still wants to perform 3D graphics in android application, then how to do it?
Programmer can use any of the above mentioned options.
openGLES is used to perform best 3D graphics in android application. How ever to use openGLES programmer should have good knowledge of C & C++.
Alternative for openGLES is AndEgnine to do 3D graphics in android. To Use AndEngine one should know only Java.
Back To Top