Tuesday, December 28, 2010

Hello Android - Your first Application


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.
Image

[hr]
2. Select "Android Project"
Image


3. Fill out the form with the Structures you like...
Image


4. This all is the code for your first Android-Application (don't panic, mostly all of them are resource-files)
Image


5. Navigate to the "Hello_Android.java" and replace the text with the following:
Image





6. Open the Run--DropDown in the upper menu and Click "Open Run Dialog..."
Image

7. Click on browse and select your project (there should be just this one). Done that, click Apply and then Run.
Image

8. The Emulator is booting...
Image

9. The "Home"-App is loading...
Image

10. Congratulations, this is your very first Hello-Android-Application!




The full source




  1. package org.anddev.android.Hello_Android;
  2. import android.app.Activity;
  3. import android.os.Bundle;
  4. import android.widget.TextView;
  5. public class Hello_Android extends Activity {
  6.     /** Called when the activity is first created. */
  7.     @Override
  8.     public void onCreate(Bundle icicle) {
  9.         super.onCreate(icicle);
  10.         // We want to view some very simple text, so we need a TextView
  11.         TextView tv = new TextView(this);
  12.         // Put some text to the newly created TextVIew
  13.         tv.setText("Hello Android - by: anddev.org n" +
  14.                         "This is soooo simple =D ");
  15.         // Tell our App to display the textView
  16.         this.setContentView(tv);
  17.     }
  18. }

1 comment:

  1. As an issue of first significance an obligation of appreciation is all together for this really uncommon work. I trust such a profitable information here in the web diary will be a best source for students . May this can grasp each one of the inquiries relate with this branch of learning. it gives a plenitude of critical data to all readers . By and by It has helped me get some decent thoughts. I trust I will see some better than average result soon.

    reviews of essay writing service

    ReplyDelete