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. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView textView = new TextView(this);
textView.setText("Hello, Android");
setContentView(textView);
}
}

 

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 🙂

Leave a comment