JSON IN ANDROID.

By | April 26, 2012

Complex JSON String parsing in ANDROID http://www.coderzheaven.com/2011/06/10/complex-json-string-parsing-in-android/ Parsing JSON Object in ANDROID. http://www.coderzheaven.com/2011/06/09/parsing-json-objects-in-android/

How to explicitly free memory in android OR Release unwanted memory in Android?

By | April 24, 2012

If you are writing memory consuming applications there is a bigger chance that your application may be running out of memory after sometime. So there are some methods in android that invokes the garbage collector explicitly. See the following function which invokes the garbage collector to free a lot of memory. A little explanation about… Read More »

Using Tabbars in ANDROID, A Simple Example……….

By | April 22, 2012

This is a simple example showing how to use tabbars in ANDROID. First create a new project and copy this code to it. Now create three another java files by right clicking the src folder and name it FirstTab.java, SecondTab.java, ThirdTab.java. Now copy the following code to FirstTab.java. SecondTab.java Now ThirdTab.java. Main.xml file AndroidManifest.xml You… Read More »

How to read and write a text file that is stored in your application sandbox in ANDROID?

By | April 22, 2012

Hi all….. In this post I will show you how to read a text file in ANDOID. Let your file is in the your application sandbox of your ANDOID project, i.e the file’s location is /data/data/your_package_name folder. To view this folder -> open File Explorer and expand each folder. For this example to work first… Read More »

Java Applet MouseEvents

By | April 22, 2012

A simple event based applet applications is described below First importing the necessary header files // Demonstrate the mouse event handlers. import java.awt.*; import java.awt.event.*; import java.applet.*; /* <applet code=”MouseEvents” width=300 height=100> </applet> */ Next step is to create a class which implements the “MouseListener” and “MouseMotionListener “ public class MouseEvents extends Applet implements MouseListener, MouseMotionListener {… Read More »

Select an Image from gallery in ANDROID and show in an ImageView.

By | April 20, 2012

Hi all In this tutorial I will show you how to get an image from your phone gallery and show it in an imageview.Here we use intents to open up the image gallery and get the image URI.   Demo   Watch Video Tutorial   Steps : Ask storage permission from the user if the… Read More »

JComboBox in Java swing

By | April 20, 2012

This shows you how to add JcomboBox to JPanel import java.awt.*; import java.awt.event.*; import java.text.DecimalFormat; import javax.imageio.ImageIO; import javax.swing.*; public class Example implements WindowListener { JFrame content_frame = new JFrame(); JPanel panel = new JPanel(); JComboBox Combonote; public Example() { content_frame.setTitle(“Contents”); content_frame.addWindowListener(this); content_frame.setSize(300, 300); content_frame.setVisible(true); content_frame.setLocationRelativeTo(null); content_frame.setResizable(false); ///cannot maximize content_frame.setVisible(true); showComboBox(); } private void showComboBox()… Read More »

How to change the hint text color in android?

By | April 20, 2012

Hello all.. This simple example will show you how to change the hint text color in android Here is the java code to simply do this. here is a sample project to view the difference. This is the contents of the main java file. The main.xml file Here I am setting a read color to… Read More »

How to get Device Orientation in Cocos2D, iPhone in Objective C?

By | April 17, 2012

Hello all…… We may need to know that what is your current device orientation. Using the below code you can do this. Note: If you have to explicitly set the orientation of your phone to any of the above you can set this in the appDelegate.m file. You can put an “||” (OR) symbol in… Read More »

How to inherit from other styles or how to extend your own styles in android?

By | April 17, 2012

Hello all…. I have covered many tutorials on styles on how to implement and use them. Today I will show you how to inherit from other styles or how to extend a style already created by you and use it for applying to other views. Here is one of my previous posts. http://www.coderzheaven.com/2012/02/03/changing-the-style-or-theme-of-default-alertdialog-in-android/ Another one… Read More »

How to animate a series of images in iphone? A simple Example.

By | April 12, 2012

The following code shows animation of 5 images. -(void)viewDidLoad { NSArray *images = [NSArray arrayWithObjects: [UIImage imageNamed:@”pic1.jpeg”], [UIImage imageNamed:@”pic2.jpeg”], [UIImage imageNamed:@”pic3.jpg”], [UIImage imageNamed:@”pic4.jpeg”], [UIImage imageNamed:@”pic5.jpeg”], nil]; CGRect frame = CGRectMake(0,0,320,460); UIImageView *imageView = [[UIImageView alloc] initWithFrame:frame]; imageView.animationImages = images; imageView.contentMode = UIViewContentModeScaleAspectFit; imageView.animationDuration = 3; imageView.animationRepeatCount = 0; [imageView startAnimating]; [self.view addSubview:imageView]; [imageView release]; [super… Read More »

How to add sprite to a body in Box2D in Adobe AIR, FLEX and FLASH? Or Add image/Sprite to a body in ActionScript.

By | April 12, 2012

The below code is for FlashBuilder 4, If you are using FlexBuilder3 use addChild() instead of the commented block in the following code.

Simulate a Balloon in Box2D, iPhone or ANDROID

By | April 12, 2012

Hello……… Sometimes you may want your body to act against the gravity of the world. One method to do this is described below. First what you have to do is to make a body in the shape of a circle and give it the image of a balloon as the userdata. Then in the tick… Read More »

Date and TimePicker in ANDROID.

By | April 12, 2012

The following code simply allows you to select a date and time using the datepicker and timepicker in ANDROID.

Saving Key-Value pair in Windows Phone using IsolatedStorageSettings

By | April 12, 2012

This sample code helps you to save a key and a corresponding value in windows Phone inside your application sandbox with the help of isolatedStorageSettings. PLease check this post before working around this post. How to save a text file in Windows Phone 7 or How to use isolated storage settings in Windows Phone 7?… Read More »

Copying an image to another in ANDROID.

By | April 7, 2012

Here is a simple example to copy an image to another image file in ANDROID. In this example a button click will open the gallery and after that it will be copied to another image file. You have to check the File-explorer to find the file. This is the java code for doing it. here… Read More »