Hello World Application in android

I have given some code snippets for some of the simple android applications under the same tag. Unfortunately, I couldn’t continue developing it further. Let me start once again now. I hope this hello world application be a good starter!

So the above diagram shows the components of Application development. Please have a look at the Android Fundamentals http://developer.android.com/guide/topics/fundamentals.html

Please install the Android SDK an ADT plugin for Eclipse as explained in http://developer.android.com/sdk/index.html

Once you are ready with the setup, create a new Android application as given in the screenshots below.

Once the project is created, You can see the default code stub HelloAndroidActivity.java have been created as above. This is a sub class of Activity. We will add a text and show it in the UI. You can see the code changes below.

package org.grassfield.helloandroid;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class HelloAndroidActivity extends Activity {
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
TextView textView = new TextView(this);
textView.setText("Hello, Android");


Now Run the project, we can see Android emulator is getting opened. Give some time to do the loading process. You can see the output as below.


have fun 🙂

A simple RSS Parsing Android application

Adding further more changes to my code given in my earlier post, I am adding the source code as well as the APK file for a simple RSS SAX parser.

This will parse the feed http://foxbrush.wordpress.com/feed and show the content on the screen. More finetuning required, will be added later.

Source file (eclipse project archive) – http://ubuntuone.com/4Id0xEpemi3JwEhIRvwQKd

APK file – http://ubuntuone.com/4SjwRCdQwh6QsoWBd46TAY

Android version required 2.3.1; Tested with my HTC

Feedparser (c) – http://www.ibm.com/developerworks/opensource/library/x-android/

HTTPURLConnection in Android

A Code snippet that reads a URL and print the HTML content on the screen, as raw text.
You may need to refer my earlier post to enable the necessary permissionpackage org.grassfield;

package org.grassfield;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class HellodroidActivity extends Activity {
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
try {
URL url = new URL("http://www.google.com");
HttpURLConnection openConnection = (HttpURLConnection) url.openConnection();
InputStream inputStream = openConnection.getInputStream();
StringBuffer sb = new StringBuffer();
int c=-1;
while ((c=inputStream.read())!=-1){
TextView textView = new TextView(this);
textView.setText("Google Output ==>"+sb.toString());
} catch (MalformedURLException e) {
TextView textView = new TextView(this);
} catch (IOException e) {
TextView textView = new TextView(this);

UnknownHostException while accessing Internet – Android

I am creating a new HelloWorld application for HTTP URL Connection demo. While accessing http://www.google.com, I am getting UnknownHostException

Obvious, we need to grant the permission for internet access. Hence add the android.permission.INTERNET permission in the manifest file as given below.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
<uses-sdk android:minSdkVersion="9" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".HellodroidActivity"
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />





Android tablet war – a review

For the past few months, I tried many times to purchase a tablet for my personal needs. Unfortunately no attemt was fruitful because I am not quiet convinced with the models I have seen.
Motorola xoom, samsung galaxy tab, acer iconia, HTC flyer etc etc. In addition, Indian market is heat because of low end tablets (midlets) like Beetel magiq, techberry techpad etc.

Motorola Xoom

Motorola Xoom

First of all let me tell you my requirement – lot of text typing (emails, wordpress, facebook, and instant messaging), youtube every night! Mostly productivity gadget. If you compare the highend models which I told above, almost all of them have android as such (with their own apps for the name sake). You will decide based on the processor, memory, and other hardware related specs like HDMI port, tv out etc. Low end models – you should be happy with what they give.

Samsung galaxy tab 10.1

Samsung galaxy tab 10.1

In the high end models, I have evaluated samsung galaxy tab, motorola xoom and HTC Flyer. Galaxy tab almost = moto xoom, but moto has a HDMI out and extendible SD card option. So still I give less marks to the Ipad competitor – samsung galaxy tab 10.1. But HTC Flyer has many drawbacks as below.
* Android v2.3 – others v3.0 or v3.1
* 7 inch screen – others 10.x inches
* costly – others are cheaper.

But still I will vote for Flyer because of the HTC Scribe technology – because of its unique way of sophistication to handwriting. I am damn sure, this will be very helpful when you get into half-a-day or full day customer visits or meetings. HTC starts working on this scribing, I hope they will make this as good as HTC sense. This is what the way phone or tablet vendors need to impress their customer. Better hardware and recent version of android alone won’t win your customer hearts.

HTC Flyer

HTC Flyer

Here is a video that can explain you the HTC scribe!

Another decision by Apple at the war-end makes me to postpone the purchase of a high end tablet (also I can’t afford that much amount now :D) the new release from Apple has a powerful CPU to compare with others for more computing. I am sure this will add unavoidable traffic in the market. I expect all the vendors will try to copy or cross this limit. So you can find better android tablets in the near future.

Let me conclude this post with a note on low end model – techberry techpad. It costs around 8500 INR, Chinese make and distributed by a Chennai based distributor of Techberry mobiles. I have purchased this tab as a interim solution till I find my dream tablet. The drawbacks of this model are
1. Low end processor – the tablet is sluggish than the other low end model Beetel Magiq
2. Not fully google – Not that much google friendly like other devices. Coundn’t map google and get alerts at real time.
3. Android market is missing and all the links are android market is failing. It has a Chinese application manager called appstore which is a ‘dhrabai’. The popular applications like meebo, google talk, plus… everything needed to be downloaded as .apk files and install it.
4. No bluetooth
5. No inbuilt 3G. You need USB modem

Techberry Techpad

Techberry Techpad

But still one convincing reason I got with this is its support to USB. USB keyboard and USB mouse is given with this midlet which makes my text typing so easier. I don’t know why high end models are not giving much support to this – or they sell these items for extra cost. I am damn sure, no one can type much with the onscreen virtual keyboard. I really got excited when I saw my USB mouse too started working. The keyboard comes with a leather like casing, which makes the carrying much simpler.

(I din’t talk about IPAD – Somehow I hesitate myself to be tied to a particular technology or particular vendor!!!)

There are many innovations coming up! See this! Solar Powered Android Tablet by Bharat Electronics – Priced at $72 http://todayontech.com/solar-powered-android-tablet-bel/

Have a wonderful week ahead!

Error in Android SDK installation : Failed to fetch URL https

Failed to fetch URL https://dl-ssl.google.com/android/repository/repository.xml, reason: HTTPS SSL error. You might want to force download through HTTP in the settings.

Not sure why this occurs, while the same URL is loading fine in the browser. Goto Settings and select http option. Then goto Installed packages once again, and press Update all,
The installation will resume!

USB tethering between Ubuntu and Android phone

This post is the continuation of my previous post on tethering. This post is a step by step to connect your Ubuntu (AMD 64) with internet using easytether and android phone. You can get EasyTether in Android shop.

1. Goto http://www.mobile-stream.com/easytether/android.html and download your driver.

2. Install the driver

Easytether installation in Ubuntu

Easytether installation in Ubuntu

3. Make sure USB debug is enabled. Easytether says that is very important. In my Xperia X10 mini, I have the menu flow like Settings>Applications>Development and connect the phone to PC via USB.

4. Connect the phone in USB

5. Open the terminal and issue the following commands

bhavani@bhavani:~$ sudo easytether enumerate
[sudo] password for bhavani:
bhavani@bhavani:~$ sudo easytether connect
connection established
run ‘sudo dhclient easytether0’ to configure the network interface
press Ctrl-C to disconnect

I tried to configure easytether0 network interface. So I kept the persent console open and issued the following command in a new console window.

bhavani@bhavani:~$ sudo dhclient easytether0
[sudo] password for bhavani:
Internet Systems Consortium DHCP Client V3.1.3
Copyright 2004-2009 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/easytether0/02:00:54:74:68:72
Sending on   LPF/easytether0/02:00:54:74:68:72
Sending on   Socket/fallback
DHCPDISCOVER on easytether0 to port 67 interval 8
DHCPREQUEST of on easytether0 to port 67
DHCPACK of from
bound to — renewal in 2147483648 seconds.

6. What else, open the browser and start browsing!! when you are completed, press Ctrl +c in the first terminal where easytether application is still running.

Happy tethering! Happy tuxing!

3G speed measurement

3G speed measurement