<activity>.java File The file in the src directory that you will spend the most time with
is <activity>.java (HelloWorldText.java in this example), which is created by the Android
plugin and named to match the Activity name that you specified in the New Android
Project wizard. Unlike most of the files you have examined in this section, this file is
completely editable; in fact, it will do very little for you if you do not modify it with
your code.
After briefly looking at what is in your HelloWorldText.java file as it is created by the
Android plugin, you will then edit the file to create your first Android Activity.
package android_programmers_guide.HelloWorldText;
import android.app.Activity;
import android.os.Bundle;
public class HelloWorldText extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
}
}
The three lines at the top of the file are the standard preprocessor directives—that is,
as in most programming languages, statements that are directives to the compiler to run
before the application process. In this case, you have the definition and inclusion of your
package android_programmers_guide.HelloWorldText.
The next two lines import specific packages from the Android SDK via android.jar:
import android.app.Activity;
and
import android.os.Bundle;
These lines tell the project to include all the code from the imported packages before all
the code in your application. These two lines are critical for your base Android application
and should not be removed..



