How To Create An Android Application Using Eclipse On .

3y ago
79 Views
6 Downloads
985.29 KB
13 Pages
Last View : 29d ago
Last Download : 3m ago
Upload by : Cade Thielen
Transcription

How to Create an Android Application using Eclipse onWindows 7Kevin Gleason11/11/11This application note is design to teach the reader how to setup an AndroidDevelopment Environment on a Windows 7 Computer using eclipse and how to createan Android application. It first explains all of the software and hardware requirementsand explains to the reader how to setup and install each of the required programs. Itthen explains how to design and code an Android application. Finally it explains how touse the Android Virtual Device to test the application.

Table of Contents1 Key Terms . 22 Objective. 23 System Requirements. 24 Installation and Configuration . 34.1 Download and Configure Eclipse IDE . 34.2 Download Android SDK . 44.3 Install ADT plugin for eclipse . 54.4 Configure the ADT plugin. . 54.5 Adding SDK Components. . 64.6 Create an AVD . 65 Create a new Android Application . 76 Coding the Application . 86.1 Changing the text . 86.2 Editing the layout . 96.3 Editing the the java code . 107 Running the Application . 118 Conclusion . 129 Resources . 121

1 Key TermsSDK (Software Development Kit) - A set of tools and libraries that allow the user to create anapplication based on a product.IDE (Integrated Development Environment) – A software application that consists of a sourcecode editor, A compiler, build automation tools and a debugger. It makes programing andrunning applications easier.ADT (Android Development Tools) – A plugin for eclipse that extends the Eclipse IDE byproviding more tools to develop Android ApplicationsAVD (Android Virtual Device) – An Android emulator that allows you to simulate how theapplication will run on an actual Android device.JDK (Java SE Development Kit) – A popular Java SDK that is used to program Androidapplications.2 ObjectiveThis document will demonstrate how to create an Android application using the EclipseIDE. It is design to guide the user through configuring his or her computer for Androiddevelopment. It also walks the user through creating and running an Androidapplication.3 System RequirementsMake sure that the computer being used for development meets the software and hardwarerequirements for the Android SDK and nts.html2

4 Installation and Configuration4.1 Download and Configure Eclipse IDEEclipse is the preferred development environment for Android. You can downloadeclipse at http://www.eclipse.org/downloads/. It is recommended that you installeither classic or the Java Version of eclipse.3

Home screen of Eclipse for Java Developers4.2 Download Android SDK1. Go to http://developer.android.com/sdk/index.html and click on the Windowsinstaller.2. This should automatically check to see if you have the proper JDK installed. Ifyou do not you can download the newest JDK /downloads/index.htmlExample of options when downloading the SDK.4

4.3 Install ADT plugin for eclipse1. Open Eclipse and go to Help- Install new Software.2. Enter https://dl-ssl.google.com/android/eclipse/ in the Work with box.Figure 3.2 Example of options when downloading the SDK.3. Then put a check mark next to the Developer Tools and click Next.4. On the next screen it will show all of the tools that will be downloaded. ClickNext.5. Read and agree the license agree to the license agreements then click Finish.6. Restart Eclipse.4.4 Configure the ADT plugin.After installing the ADT it will need to be configured to point to the SDK directory.1. Click on Window- Preferences- Android.2. Click on Browse to find the location of your SDK directory.3. Click Apply, and then OK.5

4.5 Adding SDK Components.1. Click on Window- Android SDK Manager.2. This will allow you to choose the Android platform versions, add-ons tools andother components. Choose the version of Android that you would like youapplication to work on.Note: This application note will be using 2.3.3.3. Click Install Selected and wait for the components to down. When thedownload is finished, verify and accept the new components.4.6 Create an AVD1. In Eclipse go to Window- AVD Manager- New.AVD Creation Screen6

2. Type in the Name of the AVD and choose a Target. The target is the version ofthe Android SDK that you would like to run on the emulator.3. Click Create AVD.5 Create a new Android Application1. In Eclipse go to File- New- Project 2. Select an Android Project from the Android Folder and press Next.3. Fill in the details of your Android application.a. Project Name: The project name and folder that Eclipse will store theproject filesb. Build Target: The version of the Android SDK that will be used when youbuild your program. Select a platform that is equal to or lower than thetarget chosen for the AVD.c. Application Name: This is the name of the application.d. Package Name: The namespace that all of the source code will resideunder.e. Create Activity: The name for that class stub that is generated by theplugin.4. The values that are used in this example are:a. Project Name: SampleAppb. Build Target: 2.3.3c. Application Name: SampleAppd. Package Name: com.sample.examplee. Create Activity: SampleApp5. Click on Finish.7

Figure 7.10 Screen after project creation.6 Coding the Application6.1 Changing the text1. Open strings.xml which is located in res- values- string.xml. This file will holdall of the text that our layout will use.a. Click on the strings.xml at the bottom to bring up the raw xml file.b. Using the current string xml format change the xml to includei. Name: name String: Please type your name.ii. Name: app name String: Hello Userc. Your xml file should look like:Figure 7.10 Completed string.xml8

6.2 Editing the layout2. Open main.xml which is located in res- layout- main.xml. This file will hold thelayout of the application which includes labels, textboxes, and other UIinterfaces.a. Main.xml has a GUI and a raw xml view. The GUI has many differentwidgets that you can drag and drop onto the screen.b. From the form widgets drag a Large text label and from Text Fields dragthe first and last name text box onto the phone screen.c. Then go to the raw xml view and add android:text ”@string/name” to theTextView. You can see the final raw xml below. This will take the text that islabeled “name” in the strings.xml and display it for the TextView.Figure 7.10 Final main.xml9

6.3 Editing the the java code1. Open SampleApp.java from the left hand side.2. At the top add the following import statementsa.b. This allows you to use the functions located in these files.3. Next we need to add the code to get the information from the text box and display it.The following code gets the name from the text box and forms it into a string that says“Hello [name]”. Then it uses the the toast class to display the message to the user whenenter is pressed. Enter the following code at the end of onCreate.4. Save the files.10

7 Running the Application1. Click on the green circle with the white arrow.2. Choose the AVD that we created in a previous step.3. The android AVD will load and the program will run.4.5. This is what will happen after you enter your Name and press enter.6.11

7. You have successfully completed an android application.8 ConclusionCongratulations you have successfully created an Android application. While this applicationnote taught you how to create a basic application you can use the techniques you learned toexpand on your application and turn it into something more powerful.9 network/java/javase/downloads/index.html12

running applications easier. ADT (Android Development Tools) – A plugin for eclipse that extends the Eclipse IDE by providing more tools to develop Android Applications AVD (Android Virtual Device) – An Android emulator that allows you to simulate how the application will run on an actual Android device.

Related Documents:

Android Studio IDE Android SDK tool Latest Android API Platform - Android 6.0 (Marshmallow) Latest Android API emulator system image - Android 6.0 Android Studio is multi-platform Windows, MAC, Linux Advanced GUI preview panel See what your app looks like in different devices Development environment Android Studio 9

ADT (Android Development Tool) bundle or ! Eclipse ADT plug-in Android SDK or ! Android studio ! Download earlier SDK versions using SDK manager if needed . Android Virtual Device (AVD) ! Android emulator allows . Android App Essentials ! Layout ! View objects: UI widgets such as buttons, text box etc. .

Android Development Tools ADT A plug-in for Eclipse (see Eclipse) to develop Android applications. Android Operating system for smartphones. Android Market The Android distribution service of mobile applications. Android Lifecycle A model Android uses to handle the lifecycle of an activity in applications.

Dial91 Android Edition User Guide 1 About Dial91 Android Edition Dial91 Android Edition is a SIP- based phone for an Android phone. With Dial91 Android Edition (Dial91), you can use the Wi-Fi internet connection on your Android phone to make and receive calls without using your mobile

ANDROID QUICK START GUIDE WELCOME TO ANDROID 1 1 Welcome to Android About Android 5.0, Lollipop Android 5.0, Lollipop is the latest version of Android, the oper-ating system that powers not just phones and tablets, but also wearables, TVs, and even cars. Android 5.0 features a bold and bright new design, 3D graphics

Navigate to https://developer.android.com/studio/index.html and download Android Studio for your appropriate OS. The Android SDK should be included with Android Studio. Make sure you do not choose an Android Studio installation that excludes the Android SDK. Standard download option for Windows OS (above). Alternative

2010 - May: Android 2.2 / Froyo 2010 - Dec: Android 2.3 / Gingerbread 2011 - Jan : Android 3.0 / Honeycomb - Tablet-optimized 2011 - May: Android 3.1 - USB host support 2011 - Nov: Android 4.0 / Ice-Cream Sandwich - merge Gingerbread and Honeycomb 2012 - Jun: Android 4.1 / Jelly Bean - Platform Optimization

An Android Studio SQLite Database Tutorial Previous Table of Contents Next An Android Studio TableLayout and TableRow Tutorial Understanding Android Content Providers in Android Studio eBookFrenzy.com Purchase the fully updated Android 6 Edition of this Android Studio Development Essentials publication in eBook ( 9.99) or Print ( 38.99) format