Python Tutorial

Wednesday, January 12, 2011

Android Hello World

Android hello world sample code:
    Create a android project
    Create a class named 'HelloWorldAndroid.java' and then
    paste this code

//HelloWorldAndroid.java


import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloWorldAndroid extends Activity {
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       TextView tv = new TextView(this);
       tv.setText("Hello, Android");
       setContentView(tv);
   }
}

output:

Image not found

No comments:

Post a Comment