Monthly Archives: April 2011

Customizing your button or TextView or another view in ANDROID.

By | April 30, 2011

Beautifying our applications is one of the main features of your application’s success. In ANDROID there are many possible ways to do this. For eg. We need to have different colors for our buttons, However we can give backgrounds for buttons and all. But we can do many by using our custom xml files, like… Read More »

C Sharp/C# – String Uppercase/Lowercase Conversion

By | April 28, 2011

Hi, It will be very useful to know how you can convert a given string into uppercase or lowercase using program. We are going to show you , how to convert a given string into uppercase or lowercase using C Sharp/C#. See the example given below. Output : Lowercase of sampleString : coderzheaven Uppercase of… Read More »

Android: Conversion to Dalvik format failed: Unable to execute dex: null

By | April 28, 2011

This error often comes when your android project size is large. Try the following steps to remove the error 1. Clean the project Project > Clean 2. Increase the memory allocated in eclipse.ini Open the eclipse.ini file in the the Eclipse folder. Then edit -Xms128m to -Xmx512m or something higher Hope this help you

Program to generate Fibonacci series in C Sharp/C#

By | April 27, 2011

Hi, Here is a simple program to generate Fibonacci series using C Sharp /C#. It will generate Fibonacci numbers < 100. [csharp] class MainClass { public static void Main() { int oldNum = 1; int presentNum = 1; int nextNum; System.Console.Write(presentNum + ","); while (presentNum < 100) { System.Console.Write(presentNum + ","); nextNum = presentNum +… Read More »

How to create and delete a directory in SdCard in ANDROID?

By | April 27, 2011

Hi all…… This is a simple example to create and delete a directory in ANDROID. Here the directly is created in the SDCARD. So first create an SDCARD and start the emulator with the SDCARD. Let’s look at the program. Use can use this program to create or delete a file in ANDROID also. package… Read More »

How to place a label or textBox or anyother control inside a tableView in Titanium, ANDROID or iPhone ?

By | April 26, 2011

Hi all…….. This tutorial is for Titanium users. This tutorial explains how to place a textBox or anyother control inside a tableView. A tableview requires data in the form of a array, so we create an array (here array is named “data_array“) by adding the controls like textboxes and labels inside it. You can give… Read More »

Get files from a directory – C#/C Sharp

By | April 25, 2011

Hi, Sometimes you may need to get the files from a specified directory using C# / C Sharp. See the sample code on how it works. using System; using System.IO; class MainClass { public static void Main() { string[] yourFiles = Directory.GetFiles("c:"); foreach (string fNames in yourFiles) Console.WriteLine(fNames); } } This code will get you… Read More »

C#/C Sharp – Delete file in a folder

By | April 25, 2011

Hi, Let’s see a simple example of deleting a file in a folder using c#. using System; using System.IO; public class MainClass { static void Main(string[] args) { FileInfo sampleFile= new FileInfo(@"c:SamplestestFile.txt"); sampleFile.Create(); sampleFile.Delete(); } } sampleFile.Create() will create the file in the specified folder. sampleFile.Delete() will delete the file in the specified folder. 🙂

ANDROID – Upload an image to Server in Android Studio

By | April 25, 2011

Hi all, In today’s tutorial I will show you how to send an image to server using POST method in ANDROID. Uploading an image to server is a basic requirement in many of our application. Sending data to server which is using a PHP Script is already explained in this example . Now in this… Read More »

Showing Twitter updates on Blogger/Blogspot

By | April 24, 2011

Hi, If you want to show the latest twitter update of yours in your blogger/blogspot, 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 <div class="twitter-desc"> <ul id="twitter_update_list"><li></li></ul> <script src="http://twitter.com/javascripts/blogger.js" type="text/javascript"></script> <script src="http://twitter.com/statuses/user_timeline/SampleURL.json?callback=twitterCallback2&amp;count=1" type="text/javascript"></script> </div>… Read More »

How to get notified during an incoming call and get that number inside your program in ANDROID?

By | April 24, 2011

Hi all……. In today’s tutorial I will show you how to get the incoming phone number inside your application. In many situation we may need this. For this we need to have BoradCastReceivers. Inside this class we create an object of the TelephonyManager class ang register with the sytem service.Now we have to make another… Read More »

How to create a text file in C# ?

By | April 23, 2011

Hi, How can you create a text file in C# and write to it? Sometimes you may need to create a text file using C sharp program. Here is how you can do that. using System; using System.IO; class MainClass { static void Main(string[] args) { StreamWriter yourStream= null; string yourString= "I Love Coderz Heaven!";… Read More »

Identifying sprite associated with a particular body in Box2D

By | April 23, 2011

Hi, How can you identify the sprite associated with a particular body while using box2D ? Sometimes you may need to identify the sprite associated with the body you are using. For that use the following line of code. CCSprite *yourSprite= (CCSprite*)yourBody->GetUserData(); Now you got the corresponding sprite in your ‘yourSprite’ 🙂

Android frame Animation

By | April 23, 2011

A series of frames is drawn one after the other at regular intervals. For this create a xml which contains ImageView for showing the animation <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" android:orientation="vertical" android:background="#FFFFFF" android:gravity="center_vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:id="@+id/Image" android:layout_gravity="center_horizontal" android:layout_width="wrap_content" android:background="@drawable/d1" android:layout_height="wrap_content"/> <Button android:id="@+id/startFAButtonId" android:layout_width="wrap_content" android:layout_gravity="center_horizontal" android:layout_height="wrap_content" android:text="Start Animation" /> </LinearLayout> The main java file… Read More »

A simple exception handling using C#

By | April 23, 2011

Hi, See how a very simple exception handling works with try-catch methods using C#. using System; class MainClass{ public static void Main(){ int divOne = 0; try { int ans = 79 / divOne ; } catch (Exception e) { Console.WriteLine("You got the exception-> " + e.Message); } } } Output- “You got the exception->… Read More »

Android dialog with ListView

By | April 21, 2011

For implementing a ListView, we first create a xml which contains a ListView named list.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout   xmlns:android="http://schemas.android.com/apk/res/android"   android:layout_width="fill_parent"   android:layout_height="fill_parent">   <ListView     android:id="@+id/listview"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     /> </LinearLayout> Next we create a Dialog Object and inflate the above xml and when the listItem… Read More »