Android Hello World tutorial using Eclipse for beginners – Step past times Step Android SDK implementation

Android is a Linux-based operating organisation start introduced on Nov. 5, 2007, was originally developed past times Android Inc. together with afterward purchased past times Google. It primarily runs on jail cellphone phones, but Android devices exercise thence much to a greater extent than than exactly human activity equally a phone. The Android open-source software stack consists of Java applications running on a Java-based, object-oriented application framework on exceed of Java inwardness libraries running on a Dalvik virtual machine featuring JIT compilation.

Google Android platform is fast becoming 1 of the most pop evolution platforms for your mobile devices. As to a greater extent than people are using their mobile devices for things unremarkably done from a laptop or desktop agency your customers or other internal employees such equally sales people volition before long start expecting you lot to offering them the capability to communicate amongst your information together with trace of piece of employment organisation logic through mobile devices.

Setting Up Your PC for Android Development

Things you lot require inward your PC to prepare an Android application. The best part, you lot tin download them for free:

1) Java Development Kit (JDK) of 1.5 or higher
Tip: You tin skip this measuring together with become to Step 3. When the Android Installer starts it volition cheque your organisation for Java SDK together with if non establish volition plough over you lot the link to install the Java SDK. After that it volition install the Android SDK. Then become together with convey attention of Eclipse inward Step 2.

2) Eclipse Java Developer IDE (Eclipse Ganymede or to a higher house installation)

3) Android SDK (Software Development kit)

4) Eclipse plugin for Android Development

  • Use URL https://dl-ssl.google.com/android/eclipse/ to access the Android Development Tools Plugin (ADT)

5) Android Virtual Device

  • Its exactly a simulator thence that you lot don’t get got to get got a Android Phone to TEST summation its slowly to exercise it this way for development.

Step past times Step to larn Hello World ! running on Android

Note: You don’t get got to exercise all the steps if you lot already get got Java SDK or Eclipse setup on your computer.

Setup Java Development Kit

You may already get got Java installed on your calculator but it may hold out exactly the JRE (Java Runtime Environment). You require to brand certain that you lot get got JDK (Java Development Kit) version 1.5 or higher. You tin become to the Oracle website(http://www.oracle.com) together with larn it. Here is a direct link to the JDK 1.6 version.

http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u25-download-346242.html

Setup Eclipse

Eclipse is a multi-language software evolution environs comprising an integrated evolution environs (IDE) together with an extensible plug-in system. It is written to a greater extent than oft than non inward Java together with tin hold out used to prepare applications inward Java and, past times agency of diverse plug-ins, other programming languages including Ada, C, C++, COBOL, Perl, PHP, Python, R. Ruby (including Ruby on Rails framework), Scala, Clojure, together with Scheme. The IDE is oft called Eclipse ADT (Ada Development Toolkit) for Ada, Eclipse CDT for C/C++, Eclipse JDT for Java, together with Eclipse PDT for PHP.

You tin become to http://www.eclipse.org to download or

Here is the direct link
http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/heliossr2

Eclipse is slowly to install
Once you lot get got unzipped the previously downloaded file, you lot volition run into a folder named eclipse. In that folder you lot volition discovery the eclipse application (a big blueish dot). We recommend you lot create a shortcut on the desktop to simplify the launching of eclipse. Notice that different Java, Eclipse does non get got an installation process. Once you lot get got unzipped the file you lot are done.

After beingness launched Eclipse volition inquire you lot to specify the workspace to use. The workspace is a folder used past times eclipse to continue all your work. Specify an already existing folder or get got the default provided past times Eclipse or render a novel folder.

based operating organisation start introduced on November Android Hello World tutorial using Eclipse for beginners  - Step past times Step Android SDK implementation

You are all laid for now. If you lot desire you lot tin read the manuals or click the curved arrowed you lot volition eclipse IDE.

Download the Android SDK

Here is the direct link to the Android SDK Installer
http://developer.android.com/sdk/index.html

Please banker’s complaint the SDK starter packet is non a total evolution environmentβ€”it includes entirely the inwardness SDK Tools, which you lot tin purpose to download the residual of the SDK components (such equally the latest Android platform).

For to a greater extent than information almost installing the Android SDK click here
http://developer.android.com/sdk/installing.html

Install Eclipse plugin for Android Development

Start Eclipse if has non been started. Now become to Help > Install New Software

based operating organisation start introduced on November Android Hello World tutorial using Eclipse for beginners  - Step past times Step Android SDK implementation

Click Add to to add together New Repository, basically the site where the software is.
Name = ADT Plugin
Location = https://dl-ssl.google.com/android/eclipse/

based operating organisation start introduced on November Android Hello World tutorial using Eclipse for beginners  - Step past times Step Android SDK implementation

Then Select your resources URL that you lot exactly added together with cheque the box that nation Developer Tools. After that convey all the default options, basically click Next, Finish together with get got License whatever it takes. Once it does the Install it volition inquire you lot to Restart the Eclipse, exactly convey YES.

based operating organisation start introduced on November Android Hello World tutorial using Eclipse for beginners  - Step past times Step Android SDK implementation

Eclipse is at nowadays setup for Android development

You should run into the the Android SDK together with AVD Manager nether Window menu.

based operating organisation start introduced on November Android Hello World tutorial using Eclipse for beginners  - Step past times Step Android SDK implementation

Click on Android SDK together with AVD Manager together with thence click on Installed packages. If you lot don’t run into the Android SDK together with documentation equally shown below thence click on Available packages together with Install them.

based operating organisation start introduced on November Android Hello World tutorial using Eclipse for beginners  - Step past times Step Android SDK implementation

Time to create the Android Virtual Device (AVD)

AVD is a Android Phone emulator thence that you lot tin TEST your applications without having an actual Android Phone. To deploy applications inward the emulator, you require to define an Android Virtual Device (AVD) that defines the characteristics of your device.

Select Virtual Devices inward the left panel thence Click New.

based operating organisation start introduced on November Android Hello World tutorial using Eclipse for beginners  - Step past times Step Android SDK implementation

The Create New AVD dialog appears.
Type the cite of the AVD, such equally “MyDroid3.0”.
Choose a target. 

    The target is the platform (that is, the version of the Android SDK, such equally 3.1 or 3.0) you lot desire to run on the emulator. My personal preference is ever become 1 or 2 levels down. Saves me a bunch of fourth dimension equally the latest ones gives to a greater extent than trouble.

    You tin ignore the residual of the fields for now. Click Create AVD.

    Create Hello World Android Project

    From Eclipse, select File > New > Project.

    based operating organisation start introduced on November Android Hello World tutorial using Eclipse for beginners  - Step past times Step Android SDK implementation

    If the ADT Plugin for Eclipse has been successfully installed, the resulting dialog should get got a folder labeled “Android” which should comprise “Android Project”. (After you lot create 1 or to a greater extent than Android projects, an entry for “Android XML File” volition likewise hold out available.)

    Select “Android Project” together with click Next.

    based operating organisation start introduced on November Android Hello World tutorial using Eclipse for beginners  - Step past times Step Android SDK implementation

    Fill inward the projection details amongst the next values:

    Project name: Android Tutorials
    Application name: My start Android Program, Hello World
    Package name: com.as400samplecode (or your ain individual namespace)
    Create Activity: HelloWorld

    Here is a description of each field:

    Project Name
    This is the Eclipse Project cite β€” the cite of the directory that volition comprise the projection files.
    Application Name
    This is the human-readable championship for your application β€” the cite that volition seem on the Android device.
    Package Name
    This is the packet namespace

    Create Activity
    This is the cite for the degree stub that volition hold out generated past times the plugin. This volition hold out a subclass of Android’s Activity class. An Activity is but a degree that tin run together with exercise work. It tin create a UI if it chooses, but it doesn’t require to. As the checkbox suggests, this is optional, but an Activity is almost ever used equally the the world for an application.

    Analyzing the Android Hello World Project

    Once the Hello World projection is created you lot volition the next inward your Eclipse Package Explorer.

    based operating organisation start introduced on November Android Hello World tutorial using Eclipse for beginners  - Step past times Step Android SDK implementation

    The primary Components that you lot require to facial expression hither are. Take your fourth dimension but don’t modify all the same !

    src > com.as400samplecode > HelloWorld.java
    res > layout > main.xml
    res > values > string.xml

    Let’s run the application. We volition come upwards dorsum together with play amongst these later ….

    Run the Hello World Application

    The Eclipse plugin makes it slowly to run your applications:

    Select the projection “Android Tutorials”
    Select Run > Run As.
    Select “Android Application”.

    The Eclipse plugin automatically creates a novel run configuration for your projection together with thence launches the Android Emulator. Depending on your environment, the Android emulator powerfulness convey several minutes to kicking fully, thence delight hold out patient. When the emulator is booted, the Eclipse plugin installs your application together with launches the default Activity. You should at nowadays run into something similar this (depends on what version you lot chose for the AVD emulator).

    based operating organisation start introduced on November Android Hello World tutorial using Eclipse for beginners  - Step past times Step Android SDK implementation

    Modify our Hello World Program

    Go to the strings.xml file nether src > values. It should facial expression similar this.

    <?xml version="1.0" encoding="utf-8"?> <resources>     <string name="hello">Hello World, HelloWorld!</string>     <string name="app_name">My start Android Program, Hello World</string> </resources> 

    These are the values getting displayed on the AVD emulator together with gets mapped to the layout inward main.xml

    <TextView       android:layout_width="fill_parent"      android:layout_height="wrap_content"      android:text="@string/hello"/> 

    So become ahead together with modify this values together with run into the results ! Follow the same steps to run the application equally to a higher house but this fourth dimension it volition non convey that much fourth dimension equally the AVD was already upwards together with running.

    Alternate way to modify the Hello World application

    You tin edit the HelloWorld.java directly equally directed below

    Replace the next code:
    setContentView(R.layout.main);

    With the code given below
    TextView textView = novel TextView(this);
    textView.setText(“Hello World!”);
    setContentView(textView);

    Tip: In instance you lot are getting errors is you lot require to import the missing coffee packages. An slowly way to add together import packages to your projection is to press Ctrl-Shift-O (Cmd-Shift-O, on Mac). This is an Eclipse shortcut that identifies missing packages based on your code together with adds them for you.

    Here you lot are non using the layout main.xml anymore. I am non a neat fan of this. You should ever purpose Model View Controller (MVC) architecture when available equally its slowly to hold applications that way together with different skillset tin function on different components.

    All done amongst Hello World, you lot tin mess around amongst the main.xml together with strings.xml file !

    Recommended Reading

    Hosting Unlimited Indonesia


    Sumber http://www.mysamplecode.com/