db0winsanity
Active Member
"Hello World" Android Tutorial/Setting up Emulator
Difficulty: 1/10, follow me guide
Overview: This Hello World tutorial, is being written so that you will learn the basics (and I mean basics) of Android development. Also in this tutorial, you will learn how to set up an Emulator so you can see the application you've made!
Before starting this guide I am assuming you read, and completed the Guide Setting up Eclipse for Android Development (windows)
Goals in this Tutorial:
Part I: Setting up the Project
1) Go to File > New > Project...
2) Click the arrow next to Android, then select Android Project
3) Fillout the form that's on your screen
4) Click finish
Part II: Constructing the User interface.
1) open your class its in your src folder, click:
Now that your class is open, it should look like this:
2) now, we're going to add a TextView, which shows us text on the screen of the android phone
Part III: Running the application/setting up the emulator.
1) go to Window > Android SDK and AVD manager
2) now, click on new, on the right side of the screen.
3) Call it "Emulator" or whatever you'd like
4) change target to Android 1.5 - API level 3
4) click on "create AVD"
5) Close window
6) now, to run the program, its pretty simple, go to Run > run last launched
7) a dialog will pop up, choose android application
Your finished! this is what it should look like when you're all done! congratz you finished your first android program!
*note, you do not need to re setup the emulator in every program, just this once*
I will be continueing these tutorials (Android) at some point, its late, and its not getting done now, but check back often! they'll be here!
Next tutoral: Simple adding Machine!
Difficulty: 1/10, follow me guide
Overview: This Hello World tutorial, is being written so that you will learn the basics (and I mean basics) of Android development. Also in this tutorial, you will learn how to set up an Emulator so you can see the application you've made!
Before starting this guide I am assuming you read, and completed the Guide Setting up Eclipse for Android Development (windows)
Goals in this Tutorial:
- Setting up the Project
- Constructing the User Interface
- Running the application/setting up the emulator
Part I: Setting up the Project
1) Go to File > New > Project...
2) Click the arrow next to Android, then select Android Project
3) Fillout the form that's on your screen
- Set the project name as HelloWorld
- check Android 1.5
- Set Application name as Hello World
- Set Package name as com.helloworld
- Make sure Create Activity is checked and name it helloWorld
- Min SDK version = 3
4) Click finish
Part II: Constructing the User interface.
1) open your class its in your src folder, click:
- src
- com.helloworld
- double click helloworld.java
Now that your class is open, it should look like this:
Code:
package com.helloworld;
import android.app.Activity;
import android.os.Bundle;
public class helloWorld extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
2) now, we're going to add a TextView, which shows us text on the screen of the android phone
- You now want your code to look like this:
Code:
package com.example.helloandroid;
import android.app.Activity;
import android.os.Bundle;
[B]import android.widget.TextView;[/B]
public class HelloAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
[B] TextView tv = new TextView(this);
tv.setText("Hello, Android");
setContentView(tv);[/B]
}
}
Part III: Running the application/setting up the emulator.
1) go to Window > Android SDK and AVD manager
2) now, click on new, on the right side of the screen.
3) Call it "Emulator" or whatever you'd like
4) change target to Android 1.5 - API level 3
4) click on "create AVD"
5) Close window
6) now, to run the program, its pretty simple, go to Run > run last launched
7) a dialog will pop up, choose android application
Your finished! this is what it should look like when you're all done! congratz you finished your first android program!
*note, you do not need to re setup the emulator in every program, just this once*
I will be continueing these tutorials (Android) at some point, its late, and its not getting done now, but check back often! they'll be here!
Next tutoral: Simple adding Machine!

