Monthly Archives: March 2011

“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 »

Email id verification using Objective C

By | March 29, 2011

Hi, In order to verify an email address you have entered is valid or not using Objective C, use the following code. – (BOOL) checkYourMail: (NSString *) myEmail{ NSString *checkMail= @”[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}”; NSPredicate *matchMail = [NSPredicate predicateWithFormat:@”Matching %@”, checkMail]; return [matchMail evaluateWithObject:myEmail]; } 🙂

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 »

Creating a Button using Objective C

By | March 26, 2011

Hi, Sometimes you may need to create some buttons to the View using Objective C code rather than using Interface Builder. Here is how you can do that easily and efficiently. //You can create button with type. Here I am creating a Custom Button UIButton *myButton = [UIButton buttonWithType:UIButtonTypeCustom]; //Then what? Give action to be… 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 »

Splitting a string using symbols in Objective C

By | March 20, 2011

Hi, If you want to split a string between a symbol like, ‘.’ or ‘-‘ or ‘,’ in Objective C, what to do? See the code for how to split string in Objective C. NSString *myString = @”song.mp3”; NSArray *splitArray = [myString componentsSeparatedByString:@”.”]; This code will split the string ‘myString’ into ‘song’ & ‘mp3’ (separated… 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 »