Difference among XML SAX parser, Pull parser & DOM parser

Friday, October 12, 2012


Sax Parser : Simple API of XML Parse node to node, using top-down traversing, parse without storing xml, Faster compared to Dom Manipulating of node like insertion or deletion is allowed. Needs SAXParserFactory
Dom Parser : Document Object Model Stores entire xml in memory before processing, traverse in any direction, Manipulating of node like insertion or deletion is NOT allowed. Needs DocumentBuilderFactory
Pull Parser: It provides more control and speed from the above two.

XML parsing in android.

XML is a popular format for sharing data on the internet. Websites that frequently update their content, such as news sites or blogs, often provide an XML feed so that external programs can keep abreast of content changes. Uploading and parsing XML data is a common task for network-connected apps. This lesson explains how to parse XML documents and use their data.

This is the XML parser class:

Connection.java

How to parsing JSON in android.

Friday, September 28, 2012

I am taking an example of following JSON which will give you list of contacts and each contact will have details like name, email, address, phone number ertc,.


If you observe normally JSON data will have square brackets and curly brackets. The difference between [ and { is, the square bracket represents starting of an JSONArray node whereas curly bracket represents JSONObject. While accessing these elements we need to call different methods to access these nodes.


  • Writing JSON Parser Class

In your project create a class file and name it as JSONParser.java. The parser class has a method which will make http request to get JSON data and returns a JSONObject.

Integration of android application with twitter.

Thursday, September 27, 2012


Are you an Android developer who wants to integrate your app with Twitter so that your end user can:

1. Login with Twitter
2. Post messages to Twitter

It’s not so hard to achieve these two - if you know what you are doing. And the steps below should make it easy for you to achieve the desired results.


  • Setting up the Twitter account and application.
The basic steps are:

1. You have to create an Account on Twitter before you do anything.
2. Register you application with Twitter here (https://dev.twitter.com/user)
3. Create the Activity to enter your tweet

Integration of android application with facebook.

This tutorial is about integrating facebook into your android application. I am going to explain various steps like generating your application signature, registering facebook application, downloading facebook sdk and other steps.

  • Generating App Signature for Facebook Settings

To create facebook android native app you need to provide your Android application signature in facebook app settings. You can generate your application signature (keyhash) usingkeytool that comes with java. But to generate signature you need openssl installed on your pc. If you don’t have one download openssl from here and set it in your system environment path.
Open your command prompt (CMD) and run the following command to generate your keyhash. While generating hashkey it should ask you password. Give password as android. If it don’t ask for password your keystore path is incorrect.

keytool -exportcert -alias androiddebugkey -keystore "<path-to-users-directory>\.android\
debug.keystore" | openssl sha1 -binary | openssl base64

check the following command how i generated hashkey on my pc.

keytool -exportcert -alias androiddebugkey -keystore "C:\users\raj\.android\debug.keystore"
| openssl sha1 -binary | openssl base64