Java Reference
In-Depth Information
•
src
contains the project's source code.
res
contains the following directories:
•
drawable-hdpi
containsdrawableresources(suchasicons)forhigh-dens-
ity screens.
•
drawable-ldpi
contains drawable resources for low-density screens.
•
drawable-mdpi
contains drawable resources for medium-density screens.
•
layout
contains layout files.
•
values
contains value files.
Also,
src
contains the
ca\tutortutor\j7ma
directory structure, and the final
j7ma
subdirectory contains a skeletal
Java7MeetsAndroid.java
source file.
Before you can create this app, you need to perform the following tasks:
• Createa
drawable
directoryunderneath
res
.Copythe
duke0.png
through
duke9.png
images located in this topic's code file along with
Listing 12-6
'
s
duke_wave.xml
file to
drawable
.
Thegenerated
AndroidManifest.xml
fileshouldbefine,althoughyoucanre-
place it with
Listing 12-7
if desired.
Assuming that
C:\prj\dev\Java7MeetsAndroid
is current, build this app
with the help of Apache's
ant
tool, which defaults to processing this directory's
build.xml
file.Atthecommandline,specify
ant
followedby
debug
or
release
to indicate the build mode:
•
Debug mode
:Buildtheappfortestinganddebugging.Thebuildtoolssignthe
resultingAPKwithadebugkeyandoptimizetheAPKwith
zipalign
.Spe-
cify
ant debug
.
•
Release mode
: Build the app for release to users. You must sign the resulting
APKwithyourprivatekey,andthenoptimizetheAPKwith
zipalign
.(Idis-
cuss these tasks in
Android Recipes
.) Specify
ant release
.
Build
Java7MeetsAndroid
in debug mode by invoking
ant debug
from the
C:\prj\dev\Java7MeetsAndroid
directory.Thiscommandcreatesa
gen
sub-