Tag Archives: String

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 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 »

Using ButtonBar in Adobe AIR/FLEX, A simple Example

By | March 1, 2011

Hello………. A button Bar is a convenient way to place your buttons in an application. It saves a lots of space in your application interface. Take a look at the following example which shows how to use the ButtonBar. An itemClickEvent is attached to each button in the ButtonBar. You can place as many buttons… Read More »

Creating Exceptions in JAVA

By | February 25, 2011

This is a simple custom exception in java. That is, we can create an exception by extending the exception class. The “throw new MyExcep” will throw an exception and the error message we specified will be displayed import java.lang.Exception; @SuppressWarnings(“serial”) class MyExcep extends Exception { MyExcep(String Errormsg) { super(Errormsg); // call Exception class error message… Read More »

String Functions in C

By | February 23, 2011

Let’s now briefly discuss about four essential String function used in C. We are going to discuss about a) strlen() b) strcpy() c) strcat() d) strcmp() Codes speak louder than words! Let’s see what these functions do in a simple C Program. #include main() { char stringOne[15] = “CoderzHeaven”; char stringTwo[] =”Codes”; char stringThree[15]; int… Read More »

Abstract Class in java

By | February 20, 2011

This example shows how a simple java abstract class works Here “Shape” is the abstract class abstract class Shape { abstract void initial(); // methods only defined….. abstract void display(); } class cube extends Shape { void initial() // Abstract Methods defined…. { System.out.println(“Hello !! “); } void display() { System.out.println(“How are you?”); } }… Read More »

Java Exception

By | February 19, 2011

Simple java program to show how exception works public class exception { public static void main(String[] args) { try { int a = 10; int b = 10/0; } catch(ArithmeticException e) { System.out.println(“Exception Caught ” + e); } } } The output will be like you expect Exception Caught java.lang.ArithmeticException: / by zero

Working with SQLite Database in ANDROID.

By | February 14, 2011

Below is a straight forward example of how to deal with SQLite database in ANDROID. Go ahead and copy and paste the following code to your java file. The example has one database and performs functions like insert delete and listing of values in a textView. In the XML file set up a TableLayout with… Read More »

Dynamically Load images in ANDROID? OR Load image in ANDROID using a string path.

By | February 11, 2011

With the following code you can load images in your drawable folder dynamically by giving the filename as a String. For that you have to use getResources().getIdentifier which has parameters as the “path”,”drawable” and the “package name”. This returns a unique resource ID which can be used to set the image for a ImageView using… Read More »

Play all songs from your raw directory in ANDROID continuously.

By | February 10, 2011

In ANDROID all resource has a unique resource ID which we get by passing the song name to the function below playSong(). The function getAllResourceIDs() will convert this String which is the name of the song to the unique resource ID which can then be used to play the song. setOnCompletionListener() will be executed when… Read More »

Trim() function in ActionScript(Adobe AIR , FLEX etc)…

By | February 9, 2011

The function for trim in ActionScript is defined inside StringUtil Class. Checkout the following function. public function stringTrim(result:String):String{ result = StringUtil.trim(result); trace(result); return result; } Please post your valuable comments if the post was useful. The function for trim in ActionScript is defined inside StringUtil Class. Checkout the following function. public function stringTrim(result:String):String{ result =… Read More »

Access a remote database from Adobe AIR or FLEX.

By | February 8, 2011

Access a remote database from Adobe AIR or FLEX. Many often you need to access online database from your application. For doing it in Adobe AIR of FLEX you need HttpService. The following example shows how to access an online database from an AIR Application. Note that you cannot return an array from a remote… Read More »

Pass a variable from one window to another in Adobe AIR?

By | February 6, 2011

We often need to access another window variable in the current window. The following example shows how to access a variable from one window in the next window. The logic is to create an object of next window in the current window and assign the value of variable in the current window itself so that… Read More »

Detect when the ANDROID Screen Goes Off ?

By | January 18, 2011

This is the main Java file that extends activity. Create a file named ScreenON_OFF_ACTIVITY.java and place the below code in it. This is the class that extends the Broadcast receiver class that receives the notifications. create a java file and name it ScreenReceiver.java and place the following code in it. This the class that updates… Read More »

How to send an SMS from an android application?

By | October 4, 2010

It’s easy to send Messages using the SmsManager in android. Check some of the examples relating to working with SMS’s in android. 1. How to simulate an incoming call to an emulator OR Send an SMS to an emulator in ANDROID ? 2. Listening incoming sms message in Android. 3. How to get notified during… Read More »