Archive for the ‘Android SDK’ Category

Parsing XML in Android (DOM method)

Saturday, April 10th, 2010

This is a simple example parsing twitter xml in Android

Here is the sample tweet data (one entry is one tweet)

Parsing XML with DOM method is an iterative process.
As you can see below, continuously use NodeList and Node object to explore the elements of XML document
In this example, I extracted <name> element under the <author>


Getting GPS location information in Android

Saturday, April 10th, 2010

To get geolocation information, we need to implement LocationListener

public class GPSTesting extends ListActivity implements  LocationListener {


Then, the location information will be delivered by these callback methods

in onCreate method, we can initialize locationManager and bestProvider

We can extract latitude and longitude data from the Location object just like this

mLongitude = location.getLongitude();
mLatitude = location.getLatitude();


I used latitude and longitude data to retrieve nearby twitter users.

By the way, New York is really hot! (…What?)


Samsung Moment – Android for Sprint

Saturday, March 20th, 2010

Finally, I just switched from Helio to Sprint
with Samsung Moment – Android phone with 800MHz CPU, AMOLED screen, Physical keyboards
Shipped with Android 1.5 Cupcake and Sprint announced the update to 2.1 on early 2Q2010.

It is almost pure Android without specific customization. There are just some Sprint Apps.