Category Archives: ANDROID

How to empty an NSMutableArray ?

By | April 6, 2011

Hi, Sometimes you may need to empty an NSMutableArray which is already initialized with some objects. You don’t need to release it and again alloc it for future use! You can simply empty an NSMutableArray using the following line of code. [yourArray removeAllObjects]; Here ‘yourArray’ is your NSMutableArray. 🙂

Make your own gesture application in ANDROID or How to use gestures in ANDROID?

By | April 5, 2011

Hi all…. In this tutorial I will teach you how to make use of Gestures in ANDROID and make your own application. Follow the below steps exactly to get an idea of how to use gestures. 1. Make a gesture Library. 2. Add your own gestures into it. 3. Export it to your applications and… Read More »

How to get information about all the applications installed in your ANDROID Emulator or Phone? / How to use getPackageManager() in ANDROID ?

By | April 3, 2011

Hi all, In this tutorial I will show you how to get the information about all the applications installed in your ANDROID phone. What you have to do is create a ANDROID project inside the package pack.GetAllInstalledApplications amd name the java file “GetAllInstalledApplicationsExample.java” and copy the following code into it. Here the “getPackageManager().getInstalledPackages(0);” gets information… Read More »

How to make Sprite Sheets ?

By | April 2, 2011

Hi, If you are a game developer then you will always need a sequence of images to be animated & the best way to do it is via sprite sheet animations. But how can a sprite sheet be made? Suppose you have a sequence of images of any animations, how will you convert it into… Read More »

How to sign Android project apk

By | April 1, 2011

This is a very tricky part and initially i was also ran in to strange problems . Before uploading to android market you must do the following steps. Create a Certificate Signing your application apk Finally Zip align the signed apk First the application you created should be converted to apk format. For this if… Read More »

“Conversion to Dalvik format failed with error 1” Error in ANDROID / Eclipse.

By | March 30, 2011

This is a normal error when you import some project into eclipse. I will show you how to solve this First try cleaning the project from project->Clean. If this didn’t work, then try these Follow these steps 1. Go to Project » Properties » Java Build Path » Libraries and remove all except the “Android… Read More »

"Conversion to Dalvik format failed with error 1" Error in ANDROID / Eclipse.

By | March 30, 2011

This is a normal error when you import some project into eclipse. I will show you how to solve this First try cleaning the project from project->Clean. If this didn’t work, then try these Follow these steps 1. Go to Project » Properties » Java Build Path » Libraries and remove all except the “Android… Read More »

Cocos2D Sprite Sheet Animation

By | March 29, 2011

Hi, Suppose you have a sprite sheet of the desired animation you want. But how will you use that sprite sheet animation in your program using cocos2D? That’s simple. See the following code first. Note : But how to make a sprite sheet? That topic can be found here. Making of sprite sheets from individual… Read More »

Using Gestures in ANDROID,A Simple example.

By | March 29, 2011

This is a really simple example illustrating gestures in ANDROID. You Know that everything you do with your hand inside the phone is a gesture like SingleTap, doubleTap etc. Here is a quick illustration of this. For this the activity must implement OnGestureListener. The GestureDetector detects the gestures. Let’s look at the example. The layout… Read More »

How to open browser in an ANDROID application? How to open a URL from an ANDROID application?

By | March 28, 2011

Hi all,In this tutorial I will show you how to open browser from an ANDROID application. This is done through intents. You know that intents are used to invoke other activities. So we here invoke the browser activity. The following code will open the default browser in your ANDROID phone. This is the manifest file… Read More »

How to make a sprite visible and invisible in Cocos2D ?

By | March 27, 2011

Hi, In certain situations you may need to make visible or invisible certain sprites. But how to set a sprite visible and invisible in Cocos2D? See the following Cocos2D code. //Set the sprite’s visible value to 1 to make it visible yourSprite.visible = 1; //Set the sprite’s visible value to 0 to make it invisible… Read More »

How to change the Z value of a Sprite during an action in Cocos2D ?

By | March 27, 2011

Hi, There may arise some situations where you need to change the z value of a particular sprite during an action in Cocos2D. So how can you do that? See the following lines of code. CCSprite *sample= [CCSprite spriteWithFile:@”trialImage.png”]; sample.position = ccp(160,240); [self addChild:sample z:1]; /* Some of your actions goes here! */ [self reorderChild:sample… Read More »

How to show more than one animation in sequence in Cocos2D?

By | March 25, 2011

For showing a number of animations sequentially in Cocos2D we use the CCSequence. CCSequence can accept a number of actions as parameters which will be executed in sequence , ie one after another. Here is a sample code to so this. /* This action will scale my_sprite */ id scaleTo = [CCScaleTo actionWithDuration:4 scale:1.5]; /*This… Read More »

Android listView with icons

By | March 25, 2011

In this post, we will have a list whose rows are made up of image, Here we just supply data to the adapter and helping the adapter to create a View objects for each row The output will be For this first create a xml file to hold the listview The next objective is to… Read More »

How to install a new skin for your ANDROID Emulator?

By | March 24, 2011

Hi all.. In this tutorial I will lead you to show how to install a new skin for your ANDROID Emulator. The steps are really easy 1. Download the skin from here( http://www.android.encke.net/) 2.Extract it and copy to android/platforms/the_version_of_emulator_you_want_to_skin/skins 3. Now from here you have two options for starting the emulator with the new skin… Read More »

How to add files like images inside your emulator in ANDROID?

By | March 24, 2011

In many of our android applications we need images and other files to be inside your emulator, such as images in the gallery. But unlike iPhone we cannot simply drag and drop files inside the emulator., because iPhone’s is simply a simulator. It justs creates an envoronment for testing. But ANDROID mimics the real phone.… Read More »

Using NotificationManager in ANDROID for showing notification, sample code.

By | March 18, 2011

Multiple Notifications are a unique feature in ANDROID phones. This tutorial will show you how to create notification from your application. ANDROID uses the NotificationManager class to create the notification. Let’s look at the code. Explanation. mManager.notify(APP_ID, notification); This line in the code sends the notification where notification is the object of the Notification class… Read More »

Changing the image of the sprite in cocos2D ?

By | March 17, 2011

Hi, You all know how to add an Image to a sprite. But what if we need to change the image of the same sprite? How to do that? Use the following line of code to change the image of a sprite which already initialized with a sprite. [sampleSprite setTexture:[[CCTextureCache sharedTextureCache] addImage:@”newImage.png”]]; where sampleSprite is… Read More »