Monthly Archives: April 2012

How to download a file to your android device from a remote server with a custom progressbar showing progress?

By | April 29, 2012

Actually this is really simple. I have already posted an example for how to download a file in this post. How to Download an image in ANDROID programatically? This is another one little different with a progressbar included. Previously I have shown three other methods to upload files to a server. Check these posts to… Read More »

Zoom In animation between Two Activities.

By | April 28, 2012

Hello everyone… I have already shown you how to override default animation between activities. Today I will show a zoom in and out animation between activities. Take a look at this post for another animation between activities. Create files named zoom_enter.xml and zoom_exit.xml in the res/anim folder. zoom_enter.xml file contents. zoom_exit.xml file contents. Now replace… Read More »

How to move a body manually in Box2D? or Give a force to a body in Box2D, iPhone.

By | April 28, 2012

This is a sample code to move a body in Box2D . First you have to make a body with variable name “moving_rec” and call the below function in a schedular at regular intervals. -(void) moveBody{ b2Vec2 force = b2Vec2(0,0); force = b2Vec2(0,3); //Giving the x an y to negative will move the body in… Read More »

How to include multiple c files to compile in android NDK?

By | April 28, 2012

I ran into problem when I had multiple C files in my project. Single C file was OK for me. I was getting undefined reference error while doing this. Then I found out the solution after a lot of search in google. You can check this post before going through this post. This is about… Read More »

How to upload an image from Android device to server? – Method 4

By | April 26, 2012

Hello all…. This post is also about uploading an image to server from your android device. Previously I have shown three other methods to upload an image to a server. Check these posts to refer this. 1. Uploading audio, video or image files from Android to server 2. How to Upload Multiple files in one… Read More »

Pause And Resume iPhone Game Using Cocos2D

By | April 26, 2012

More than usually we need to apply the functions of Pause and Resume/Play for our games. In Mac’s cocos2D programming it’s more than simple. Simply use the following code for Pause & Resume where ever you want! /*For Pausing the game*/ [[CCDirector sharedDirector] pause]; [self pauseSchedulerAndActions]; //Call for pausing all schedulers and actions /*For Resuming/Playing… Read More »

How to Refresh a HTML Page Using JavaScript ?

By | April 26, 2012

Hi, Most probably you may have encountered a situation where you have to refresh the web page in your code. Here is, how it could be done using JavaScript. Sample Refresh Here on button click it will call the function ‘refresh_yourPage()’, and it will refresh the page! 🙂

How to enable retina Mode in Corona SDK? or How to work with images in retina Mode in Corona?

By | April 26, 2012

To enable retina mode in your application you have to first find the config.lua file in your project folder. Then edit this file to include the contents like this. You have to include images twice the size([“-x2”] = 2) and about 1.5 the size ([“-x15”] = 1.5) in your project folder. These images should have… Read More »

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 »