Author Archives: Soorya

Java check memory Allocation

By | April 7, 2012

When run the code the output will be similar to this Total memory is: 5177344 Initial free memory: 4986744 Free memory after garbage collection: 5063784 Free memory after allocation: 5045296 Memory used by allocation: 18488 Free memory after collecting discarded Integers: 5063784

How to take screenshot of application and store it in SDCARD?

By | October 26, 2011

The first part is explained in this Tutorial, that is taking the screenshot of the application (View). The second part is storing it in the SDCARD. This is possible by compressing the image bitmap to bytes and then store. Finally dont forgot to put the following permission in the manifest file.

How to listen to the softkeyboard done button in android?

By | July 13, 2011

Instead of using a button on the view we can use the softkeyboard done button to trigger an action. The action can include calling another activity or retrieving the data from the EditText etc. The main.xml contains an Edittext For listening to the keyboard event we need onKeyListener

C++ program to add two complex nos.

By | June 18, 2011

The program contains a class complex with two member variables x and y and a string class with one member variable. Two objects are created for complex class and string class and accepted values through read () function and their values are added using the operator overloaded function and assigned to the third object for… Read More »

C++ program append the two text files

By | June 18, 2011

Three file objects are created using the fstream class one for first, second for second file and third for the appended file. The first two files are opened in the input mode and third in the append mode. The first file is opened and checked for error condition if the file exist its contents are… Read More »

C++ program to copy the contents of a text file to another

By | June 18, 2011

Two file objects are created using the fstream class for the two files, one for source file and another destination file. The first file is opened and its contents are copied to the second file using get ( ) and put ( ) function. Each time the source file is opened error checking is done… Read More »

Applet FlowLayout Example

By | May 16, 2011

The FlowLayout class puts components in a row, sized at their preferred size. Creates a new flow layout manager with the indicated alignment and the indicated horizontal and vertical gaps. The hgap and vgap arguments specify the number of pixels to put between components. The output window look like this

Listening incoming sms message in Android

By | May 1, 2011

When a new sms message is received by the device, a Broadcast Receiver is registered. For this IntentFilter filter = new IntentFilter(SMS_RECEIVED); registerReceiver(receiver_SMS, filter); should be included . Also sms are sent in PDU’s(Protocol Description Units) format, which act as an encapsulation. Inorder to extract from PDU to byte array messages[i] = SmsMessage.createFromPdu((byte[]) pdus[i]); method… 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

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 The main java file is Next the main part, an xml which holds each image and duration in which each image shows. The xml should be placed inside drawable folder… 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 Next we create a Dialog Object and inflate the above xml and when the listItem is clicked then a Alert Dialog windows comes The java file is listed below The alert window look like this When the Item is selected… Read More »

Applying a shape to xml in android

By | April 15, 2011

By adding a custom shape we can make the layout more attractive. For this we have to create a xml file and specify this in the main layout xml file First make a xml inside the drawable folder. Then in the main file specify this shape like this. The “category” is the name of the… Read More »