Thursday, September 30, 2010

Sample Adroid Program – Hello World

After successful extraction of both the packages, check all the preferences and fix them. Create a Virtual Device If everything is ready, you can write your first Android program.

To do this –

1.Open Eclipse.exe

2.File -> New -> Project

3.Android -> Android Project -> Next

4.Enter Project Name, Build Target, Application Name,Package Name, Create Activity and Min SDK version. -> Finish .

5.Now look on the Project Explorer -> [Project Name] -> src -> [Package Name] -> [ProjectName.java]. Double click on it. In code editor section, type or paste the following codes –

package com.example.helloandroid;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;


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

public class HelloAndroid 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);

}
}



And Run!

No comments:

Post a Comment