Hello World by Elliot Khazon
Prerequisites JAVA SDK 1.5 or 1.6 Windows XP (32-bit) or Vista (32- or 64-bit) 1 + more Gig of memory 1.7 Ghz+ CPU
Tools Eclipse IDE 3.4 or 3.5 SDK starter package
Installation Install Eclipse Unzip eclipse zip file to to c:\eclipse directory Start eclipse c:\eclipse\eclipse.exe Set Java SDK variable in eclipse
Installation Cont d
Install Starter Package Extract to C:\android-sdk-windows Add \tools directory to your windows PATH variable
Install ADT for Eclipse 3.5 Start Eclipse, then select Help > Install New Software. In the Available Software dialog, click Add... In the Add Site dialog that appears, enter a name for the remote site (for example, "Android Plugin") in the "Name" field. In the "Location" field, enter this URL: https://dl-ssl.google.com/android/eclipse/
ADT Plugin, Cont d Note: If you have trouble acquiring the plugin, you can try using "http" in the URL, instead of "https" (https is preferred for security reasons). Click OK. Back in the Available Software view, you should now see "Developer Tools" added to the list. Select the checkbox next to Developer Tools, which will automatically select the nested tools Android DDMS and Android Development Tools. Click Next
Install ADT Plugin slide 3 Read and accept the license agreement and then click Finish. This will download and install the latest version of Android DDMS and Android Development Tools. Restart Eclipse.
Configuring the ADT Plugin Select Window > Preferences... to open the Preferences panel (Mac OS X: Eclipse > Preferences). Select Android from the left panel. For the SDK Location in the main panel, click Browse... and locate your downloaded SDK directory: C:\android-sdk-windows
Add Android Platforms and Other Components Open Eclipse Window > Android SDK and AVD Manager You have 3 options Basic SDK Tools SDK platform You need to download at least one platform into your environment, so that you will be able to compile your application and set up an Android Virtual Device (AVD) to run it on (in the emulator). To start with, just download the latest version of the platform. Later, if you plan to publish your application, you will want to download other platforms as well, so that you can test your application on the full range of Android platform versions that your customers are using. Recommended Documentation Samples Usb Driver
Android Components part 3 Full Google APIs The Google APIs add-on gives your application access to the Maps external library, which makes it easy to display and manipulate Maps data in your application. Additional SDK Platforms If you plan to publish your application, you will want to download additional platforms corresponding to the Android platform versions on which you want the application to run. The recommended approach is to compile your application against the lowest version you want to support, but test it against higher versions that you intend the application to run on. You can test your applications on different platforms by running in an Android Virtual Device (AVD) on the Android emulator.
Android package install
Restart Eclipse!
Hello World app Create an AVD Android Virtual Device (AVD) defines the system image and device settings used by the emulator. Our AVD Name = avd_1 Target = 2 /*****Uses Android 1.1 target ***/
Hello World - Create AVD Enter the following commands cd c:\android-sdk-windows\tools android create avd --target 3 --name avd_3 The tool now asks if you would like to create a custom hardware profile. Type no
Start Writing Code Create a new Android Project File > New > Project > Android Project Project name: HelloAndroid Application name: Hello, Android Package name: com.ottborr.android.helloandroid (or your own private namespace) Create Activity: HelloAndroid Build Target Android 1.5 Min SDK Version: 3 /*** min API supported is Android 1.1 ***/ If an application requires an API Level that is higher than the level supported by the device, then the application will not be installed.
Helllo World cont d Modify HelloAndroid class @Override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); TextView tv = new TextView(this); tv.settext("hello, Android"); setcontentview(tv); } }
Run>Run