Tag Archives: Lt

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 »

Complex JSON String parsing in ANDROID

By | June 10, 2011

Hello all….. In the previous post I have shown you how to parse a Simple JSON String in ANDROID. In today’s tutorial I will show you how to parse a complex JSON String. Take a look at the example Here the JSON String used is Now let’s dothe operation……….. Please check the Logcat for the… Read More »

Parsing JSON Object in ANDROID.

By | June 9, 2011

JSON are alternative to XML and easy to understand than XML. As other languages Java also supports JSON parsing. Here is a simple example of JSON parsing in ANDROID. This is the JSON String that I am going to parse. And this JSON is same as this xml. Here is the code for this parsing.… 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

How to split a String in ANDROID?

By | May 5, 2011

Hi all….. Splitting a string in android is really easy.checkout the following snippet. Check the Logcat for output. Note: Make sure to put the escape character before the delimiter for splitting,otherwise the output may be each character.

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 »

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 »

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 the SMS sent to your emulator within your application? OR Get notified when an SMS arrives to your phone.

By | April 20, 2011

Actually these are done using services in ANDROID. These are called BroadcastReceivers.Your class has to extend the BroadcastReceiver class to get these broadcast events. But note that these services need to have an interface. So you will not see any UI on the device. But don’t think your application is not running or not installed.… Read More »

Expandable ListView in ANDROID using SimpleExpandableListAdapter, a simple example.

By | April 10, 2011

Hi all…… Here is a simple example of expandandable ListView in ANDROID. But I am not going to explain any code, because everything is explained inside the java file. Make sure to read it. package pack.Coderzheaven; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import android.app.ExpandableListActivity; import android.os.Bundle; import android.view.View; import android.widget.ExpandableListView; import android.widget.SimpleExpandableListAdapter; public class ExpandableListDemo… Read More »

How to check whether GPS is available in ANDROID or Not?

By | February 24, 2011

This code helps you to check whether the location service is available on your ANDROID Phone or not. Copy this code and paste to your file. Happy coding….. public boolean GPSAvailable() { LocationManager loc_manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); List<string> str = loc_manager.getProviders(true); if(str.size()>0) return true; else return false; }

How to set wallpaper in ANDROID?

By | February 17, 2011

Following example shows how to set a Bitmap as wallpaper in ANDROID. After running this code your wallpaper on the ANDROID phone will change. Make sure that you have an image named ‘my_wallpaper’ in your drawable folder. And You have to set this permission in the Manifest. <uses-permission android:name="android.permission.SET_WALLPAPER"/> Bitmap wallpaper = BitmapFactory.decodeStream(getResources().openRawResource(R.drawable.my_wallpaper)); try {… Read More »

How will you access the clipboard in an AIR application?

By | January 15, 2011

The following is a sample code to do this. Simply copy and paste. <xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()"> public function init():void{ var str : String = "Hello"; System.setClipboard(str); var versionString:String = Capabilities.version; var pattern:RegExp = /^(w*) (d*),(d*),(d*),(d*)$/; var result:Object = pattern.exec(versionString); if (result != null) { trace("input: " + result.input); trace("platform: " + result[1]); trace("majorVersion: " +… Read More »

How to start an application at bootup in ANDROID?

By | October 4, 2010

This snippet starts an Application automatically after the android-os booted up. String url = "url"; Intent intent1 = new Intent(Intent.ACTION_VIEW); intent1.setData(Uri.parse(url)); startActivity(intent1); in AndroidManifest.xml (application-part): <receiver android:enabled="true" android:name=".BootUpReceiver" android:permission="android.permission.RECEIVE_BOOT_COMPLETED"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </receiver> [..] <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> [..] public class BootUpReceiver extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent)… Read More »