How to make static/non rotating bodies in Box2D ?
Hi, Sometimes you may need to make some of your b2Body non rotating or static while using Box2D physics engine. For making any body static use the following line of code. 🙂
Hi, Sometimes you may need to make some of your b2Body non rotating or static while using Box2D physics engine. For making any body static use the following line of code. 🙂
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 »
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/
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 »
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 »
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 »
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 »
Hi, Collision can be detected simply using the following lines of code with box2D. Here aimFixture & tarFixture are two custom fixtures whose collision you want to find out. 🙂
Hi, If you want to show the preview of your older posts at random in blogger page then use the following steps 1. Go to your blogger ‘Design’ 2. Click ‘Add A Gadget’ 3. Add ‘HTML/JavaScript’ 4. Paste the following JavaScript code into it and save 5. Done! Note : Replace your blogger url in… Read More »
Hello all.. I have shown two other examples for creating a connection between android and php. But still users are finding difficulty in grasping it. These are other posts. Android phpMysql connection. Android phpmySQL connection redone. Here is one more post on this which is even more detailed. OK we will start now. First create… Read More »
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 »
Hi, Use the following simple lines of code to check whether a particular file exists or not using C#/C Sharp. It will return either True or False depending on whether your file exists or not. 🙂
CCWaves is one of the interesting functionalities in Cocos2D iphone. Check out this following snippet to see how it works. Please leave your valuable comments on this post………………….
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 »
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 »
Hi, If you want to scroll a UIScrollView programatically as the result of any IBOutlet actions, use the following code in that particular action. [yourScroller setContentOffset:CGPointMake(0,250) animated:YES]; This will scroll your scroller named ‘yourScroller’ automatically to the point specified! 🙂
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 »
Set background color to magenta. CCColorLayer* colorLayer = [CCColorLayer layerWithColor:ccc4(255, 0, 255, 255)]; [self addChild:colorLayer z:0]; //Changing the color of a sprite…. ((CCSprite*)node).color = ccRED; // This will change the sprite color to RED.
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 »
On implementing the onGestureListener you can get the events like Fling LongPress Scroll ShowPress SingleTap Its really simple, otherwise we have to calculate the distance between the touchdown and touchup event to check a fling event is happened or not.
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 »
The below code is for FlashBuilder 4, If you are using FlexBuilder3 use addChild() instead of the commented block in the following code.
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 »
The following code simply allows you to select a date and time using the datepicker and timepicker in ANDROID.
Hi, Sometimes you may need to convert string to double using C#, see the following lines of code to see how you could do it. 🙂