Author Archives: admin

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 »

How to stop the sprite sheet animation in cocos2D ?

By | March 17, 2011

Hi, In one of our previous post we have discussed how to animate sprite sheet in cocos2D. In some cases you may need to stop the sprite sheet animation abruptly. How to do that? Here the way to do that. Use the following. [spriteName stopAction:spriteNameAction]; where spriteName is the name of your sprite & spriteNameAction… Read More »

How to create OptionsMenu in ANDROID?, a simple example……

By | March 16, 2011

This is a simple example of creating options Menu in ANDROID. This menu can be seen by clicking on the “Menu Button” in ANDROID. Check out this example. The main.xml for the above code is

Context menu in android

By | March 16, 2011

What is context menu? Where it is used? How it is used? I will cover all these questions… Context Menu A context menu is conceptually similar to the menu displayed when the user performs a “right-click” on a PC. You should use a context menu to provide the user access to actions that pertain to… Read More »

Crop an Image in ANDROID.

By | March 15, 2011

Cropping an image in ANDROID programmatically has always been a problem for ANDROID developers. So Here I am putting a sample code to demonstrate this. For cropping an image in ANDROID we need a source bitmap which is our image itself, the other one is the target bitmap which we have to set the size… Read More »

Sprite Sheet Animation in Cocos2D – An Example

By | March 14, 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. //Initializing a CCSpriteBatchNode with our sprite sheet image CCSpriteBatchNode *newSpriteSheet = [CCSpriteBatchNode batchNodeWithFile:@”jumpingOver.png”]; //Adding the spriteSheet to the layer & setting… Read More »

Adding Image to a UIImageView using Image URL

By | March 14, 2011

Hi, Sometimes you need to add Image to a UIImageView from the URL of the image you got. In that case, this is how you can add image to the UIImageView. NSString *picURL= @”http://photobucket.com/yourImage.gif”; NSData *picData = [[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:mapURL]]; UIImage* picture = [[UIImage alloc] initWithData:picData]; [pictureView setImage:picture]; [picData release]; [picture release]; Here, pictureView is… Read More »

How to create a new Virtual SD card in emulator in ANDROID? How to start emulator with the created SDCard?

By | March 13, 2011

OK The first question is 1. How to create a new Virtual SD card in emulator in ANDROID? Many times we may have not enough memory for our application to run on the emulator. So what we do? One method is to create new virtual device with more memory. Another method is to extend the… Read More »

How to create a scrolling ListView in android?

By | March 12, 2011

ListView is like a tableView in iPhone or iOS . In this example i will show you how to add a String Array in to the ListView and also make the listView Scrollable. First the xml file . Here the line android:scrollbars=”vertical” will make the scrolling vertically Now the java file The screen will be… Read More »

How to read a folder in the assets directory and read files from it in android?

By | March 12, 2011

File reading is important in android. For the put the files in the assets folder. We can able to read foldername filename Contents of the file First we read the name of the folder. “folder_array” contains all the names of the folder Then if the path is set to Then the list of file name… Read More »

Copying a Sprite Image to another Sprite in Cocos2D

By | March 11, 2011

Hi, Suppose you want to copy a sprite image to another new sprite while using cocos2D. What you do? See the following code… Let oldSprite be your first sprite CCSprite *oldSprite = [CCSprite spriteWithFile:@”ImgOne.png”]; And newSprite be your second sprite CCSprite *newSprite = [CCSprite spriteWithTexture:[oldSprite texture]]; That’s it! Done! Now newSprite too contain ImgOne as… Read More »

Playing sound on the Mac Desktop in Objective C.

By | March 11, 2011

There are different ways for playing sound on the Mac in Objective C. Let’s look at some of the methods.. 1. Play by filename. NSSound *mySound = [NSSound soundNamed:@”sound”]; if you have no file named “sound” in your application’s main bundle, then it will return nil. 2. Play by pathName sound = [[NSSound alloc] initWithContentsOfFile:@”/Volumes/Audio/sound.aiff”… Read More »