User Touch handling on sprite in android

User Touch handling on sprite in android

In this example we will implement onTouchEvent() to handle user touch on SurfaceView. When user touch on the screen(SurfaceView), it will call setX(x) and setY(y) of mySprite object to update its position. Algorithm: 1.) Create a new project by File-> New -> Android Project name it UserTouchOnSurfaceView. 2.) Write...
0
Moving Sprite Automatically in Android

Moving Sprite Automatically in Android

In the last post we have introduced Sprite without movement. Now we are going to make it move. First we will modify SpriteExample.java to make it random move inside the canvas then we will modify ForegroundSurface.java to override updateStates() and call mySprite.update() indirectly. Algorithm: 1.) Create...
0
Introducing Sprite in android

Introducing Sprite in android

In the last post foreground SurfaceView, the object on foreground was draw as a bitmap. Now we are going to implement a Sprite class. The Sprite class’s object keeps its own status such as location(x, y) and bitmap, and also draws itself on canvas. Algorithm: 1.) Create a new project by File->...
0
Foreground surfaceview in android

Foreground surfaceview in android

In previoud posts, we have created a custom SurfaceView with background thread. Now we are going to create another ForegroundSurface class by extending our GameSurface, with overriding code. Algorithm: 1.) Create a new project by File-> New -> Android Project name it ForegroundSurfaceView. 2.) Write...
0
Foreground surfaceview in android

Foreground surfaceview in android

In previoud posts, we have created a custom SurfaceView with background thread. Now we are going to create another ForegroundSurface class by extending our GameSurface, with overriding code. Algorithm: 1.) Create a new project by File-> New -> Android Project name it ForegroundSurfaceView. 2.) Write...
0
How to fix flickering in SpriteGame

How to fix flickering in SpriteGame

In this example we will try to fic flickering issue which comes in our previous example “ SpriteGame”. If you try the code you can note that the screen seem to flicker between two bitmap! It’s due to double buffer of Android’s SurfaceView. In order to solve the problem, we can draw on...
0
Sprite game example in android – Step1

Sprite game example in android – Step1

In this example we will create surface view for our game and implement background thread for it. First we have created DUMMY MyGameSurfaceView and MyGameThread classes, without any function, and without any interaction. In this step, we are going to modify the Java code to make them work together. Algorithm: 1.) Create...
0
USM Image processing on android

USM Image processing on android

The Unsharp Mask filter sharpens edges of the elements without increasing noise or blemish. You can refer to GIMP doc to know how does an unsharp mask works. As my understanding, for each pixel = original + (original – blur) In this example we will use the blurred image to obtain the USM image....
0
Custom Dialog with data passing using bundle

Custom Dialog with data passing using bundle

This example will explain how a custom dialog is create in onCreateDialog(). The text in the EditText will be passed to the custom dialog via a bundle in onPrepareDialog(int, Dialog, Bundle). If you use showDialog(int), the activity will call onCreateDialog() method the first time, and hang onto it...
0
Image Processing in Android Part II

Image Processing in Android Part II

This example will explain how to apply blur effect on bitmap. Lets try to do this our self without using any API. This can be done using Convolution Matrix according to the Image Processing example explained in previous post. In this example, we will use Gaussian matrix which is used as the 7 x 7 kernal...
0
Proudly designed by Theme Junkie.