Develop Android applications with EclipseGet started with Google's Android Development Tools Eclipseplug-inSkill Level: IntermediateFrank Ableson
The Android SDK is a compressed folder. Download and extract the contents of thisfile to a convenient place on your computer. For purposes of this tut
that the license agreement includes a special requirement for use of theGoogle Maps API.6. Review and accept the installation location, then click Fin
New project wizardThe first step is to create a new project. Select the wizard for Android project, asshown below.Figure 2. New project wizardThe requ
• Package name• Activity name — Think of this as the main "form" or screen of theapplication• Application nameTake a look at the new project
The Package ExplorerThe Package Explorer (found in the Java perspective in Eclipse) displays all thecomponents of the sample Android application (see
src folderIncludes the package for the sample application, namelycom.msi.ibmtutorialR.javaThe Android Developer Tools create this file automatically a
super.onCreate(icicle);setContentView(R.layout.main);}}Things to note about this source snippet:• SaySomething is a normal Java class, with a package
The sample application contains a single activity and a single view. The applicationcontains a file named main.xml that represents the visual aspects
Listing 6. R.java file/* AUTO-GENERATED FILE. DO NOT MODIFY.** This class was automatically generated by the* aapt tool from the resource data it foun
We introduced an error into the source code where we added an extra spacebetween setContent and View. When the file is saved, it is compiled and anyer
Why do we care about Android? Android is an important platform for two reasons.First, the fact that Google is introducing it and the mind-share Androi
</manifest>Things to note:• The package name from the source file is represented here. This followsa similar pattern to a Java source file and i
Give the configuration a name. The tutorial sample uses the name TutorialConfiguration. Select the ibmtutorial project from the list of available proj
There are a few screen sizes and orientations to choose from, as well as networkchoices. The network choices are important when building applications
Now that the application is running on the Emulator, it's time to see what'shappening behind the scenes. The Dalvik Debug Monitor Service (D
The LogCat is a running log file of activity taking place in the VM. Applications canmake their own entries to this list with a simple line of code as
User applications are deployed in /data/app while Android built-in applications arefound in the /system/app directory.A running process list is also a
Full-scale debugging of an Android application is beyond the scope of this tutorial.For more information, see Resources.Section 6. Building the conten
contacts recorded and be sure to populate the home address field. Figure 12 showsthe Emulator with a few entries in the contact application.Figure 12.
developerWorks® ibm.com/developerWorksDevelop Android applications with EclipsePage 28 of 35 © Copyright IBM Corporation 1994, 2008. All rights reserv
Here is the first of two code snippets for the second application. Note that thisapplication's main Activity class extends the ListActivity. This
• Main.xml — This contains the visual elements, or resources, for use byAndroid activities.• R.java — This file is automatically generated by Android
Any one of the contacts may be selected by a tap (click of the mouse), the centerbutton on the emulator, or by pressing the Enter key on your keyboard
Listing 7. The onListItemClick() overridden method@Overrideprotected void onListItemClick(ListView list,View view,int position,longdbidentifier){super
There is a single activity launched from the main application screen. There is, ofcourse, the AndroidManifest.xml file identifying our new application
DownloadsDescription Name Size Download methodExample source code os-eclipse-android.examples.zip67KB HTTPInformation about download methodsibm.com/de
ResourcesLearn• The author's Android book is available in part online at Manning Publications.• The authoritative Android information source is G
Tivoli®, and WebSphere®.• Innovate your next open source development project with IBM trial software,available for download or on DVD.Discuss• The Ecl
platforms, including servers, desktop computers, networking appliances, andmobile-computing devices. Android runs on top of a Linux kernel.Dalvik Virt
clicking and tapping to operate. Sure, there are menus and buttons to be tapped, butAndroid has an innovative design element to its architecture known
Let's take a moment to examine the four main types of Android applications: activity,services, receivers, and ContentProvider. We will also take
public class myreceiver extends IntentReceiver{public void onReceiveIntent(Context arg0, Intent arg1){// do something when this method is invoked.}}Da
View elements consist of familiar UI elements, including:• Button• ImageButton• EditText• TextView (similar to a label)• CheckBox• Radio Button• Galle
Note that each element has one or more attributes in the Android name space.The next section walks through obtaining the Android SDK and configuring i
Commentaires sur ces manuels