Building your very first "Hello Android" - Application
What is this: This tutorial shows how to create the simplest application possible at all.
What you learn: Create an Android-Project in Eclipse, alter some code and create a Run-Configuration.
What it will look like:
Follow these steps:
1. At first, we have to create a new Project. Right-Click on some free space in your Package-Explorer.
[hr]
2. Select "Android Project"
3. Fill out the form with the Structures you like...
4. This all is the code for your first Android-Application (don't panic, mostly all of them are resource-files)
5. Navigate to the "Hello_Android.java" and replace the text with the following:
6. Open the Run--DropDown in the upper menu and Click "Open Run Dialog..."
7. Click on browse and select your project (there should be just this one). Done that, click Apply and then Run.
8. The Emulator is booting...
9. The "Home"-App is loading...
10. Congratulations, this is your very first Hello-Android-Application!
The full source
- package org.anddev.android.Hello_Android;
- import android.app.Activity;
- import android.os.Bundle;
- import android.widget.TextView;
- public class Hello_Android extends Activity {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- // We want to view some very simple text, so we need a TextView
- TextView tv = new TextView(this);
- // Put some text to the newly created TextVIew
- tv.setText("Hello Android - by: anddev.org n" +
- "This is soooo simple =D ");
- // Tell our App to display the textView
- this.setContentView(tv);
- }
- }