锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久亚洲国产成人影院网站,爱情岛亚洲论坛在线观看,亚洲AV美女一区二区三区http://www.tkk7.com/awaycatalongfish/zh-cnSat, 12 Jul 2025 21:04:52 GMTSat, 12 Jul 2025 21:04:52 GMT60Creating Your First Programhttp://www.tkk7.com/awaycatalongfish/archive/2011/05/09/349834.html涓嶇埍鍚冪尗鐨勯奔涓嶇埍鍚冪尗鐨勯奔Mon, 09 May 2011 05:51:00 GMThttp://www.tkk7.com/awaycatalongfish/archive/2011/05/09/349834.htmlhttp://www.tkk7.com/awaycatalongfish/comments/349834.htmlhttp://www.tkk7.com/awaycatalongfish/archive/2011/05/09/349834.html#Feedback0http://www.tkk7.com/awaycatalongfish/comments/commentRss/349834.htmlhttp://www.tkk7.com/awaycatalongfish/services/trackbacks/349834.html going to use to create a simple “Hello, Android” program in just a few
seconds.
ADT甯︽湁鍐呯疆鐨勪緥瀛愬拰妯℃澘,鎴戜滑鍙互鍦ㄥ嚑縐掗挓鍐呭垱寤轟竴涓畝鍗曠殑"Hello android"鐨勪緥瀛?br />
Get your stopwatch ready. Ready? Set? Go!
鍑嗗濂界琛?ready?go

Select File > New > Project... to open the New Project dialog box. Then
select Android > Android Project, and click Next.

Enter the following information:
Project name: HelloAndroid
Build Target: Android 2.2
Application name: Hello, Android
Package name: org.example.hello
Create Activity: Hello
Min SDK Version: 8
When you’re done, it should look something like Figure 1.3, on the next
page.
Click Finish. The Android plug-in will create the project and fill it in
with some default files.
 鍗曞嚮 finish,android鐨勬彃浠跺氨浼氬垱寤轟竴涓伐紼?br />
Eclipse will build it and package it up so it will
be ready to execute. If you get an error about missing source folders,
select Project > Clean to fix it.
OK, that takes care of writing the program; now all that’s left is to try
running it. First we’ll run it under the Android emulator.

1.3 Running on the Emulator
To run your Android program, go to the Package Explorer window,
right-click the HelloAndroid project, and select Run As > Android Appli-
cation. If you’re following along in Eclipse, you may see an error dialog
like the one in Figure 1.4, on page 25. This indicates we haven’t told
the emulator what kind of phone to emulate.
Creating an AVD
To do this, you need to create an Android Virtual Device (AVD) using
6
either Eclipse or the android avd command. It’s easier to use Eclipse,
so select Yes in the AVD Error dialog to open the AVD Manager. You can
open the manager again later by selecting Window > Android SDK and
AVD Manager.
6. http://d.android.com/guide/developing/tools/avd.html
Report erratum
this copy is (P1.0 printing, July 2010)

RUNNING ON THE EMULATOR 24
Figure 1.3: New Android project
Report erratum
this copy is (P1.0 printing, July 2010)

RUNNING ON THE EMULATOR 25
Keeping Up with the Plug-In
The Android Eclipse plug-in is a work in progress that changes
much more often than the Android SDK. The version you down-
load may be different from the one I used when writing this
book, and it may contain a few, shall we say, idiosyncrasies. I
recommend you check the plug-in site monthly to pick up any
new features and fixes.
Figure 1.4: Missing Android Virtual Device (AVD)
Click the New... button, and then fill out the fields for the new AVD as
follows:
Name: em22
Target: Android 2.2 - API Level 8
SDCard: 64
Skin: Default (HVGA)
This tells Eclipse to set up a generic device called “em22,” which has the
Android 2.2 (FroYo) firmware installed. A 64MB virtual Secure Digital
(SD) card will be allocated, along with a half-VGA (320×480) display.
When you are done, you should see something like Figure 1.6, on
page 27. Because of updates in the SDK tools since this was written,
your screen may look slightly different.
Click Create AVD to create the virtual device. A few seconds later you
should see a message that the device has been created. Click OK, select
the AVD, and then click Start... and then Launch to bring it up. Close
the AVD Manager window when you’re done.
Report erratum
this copy is (P1.0 printing, July 2010)

RUNNING ON THE EMULATOR 26
Cupcake vs. Donut vs. Eclair vs. FroYo
TheversionofAndroidrunningonyouremulator(orrealphone)
mustbecompatiblewithyourprogram’sbuildtarget.Forexam-
ple, if you try to run an Android 2.2 (FroYo) program on an
Android 1.5 (Cupcake) phone, it won’t work because Android
1.5 phones can only run 1.5 or earlier programs. Android 2.2
phones, on the other hand, can run programs built for 2.2, 2.1,
2.0.1, 2.0, 1.6, 1.5, and earlier. But it may be a while before most
phones have been upgraded (if ever).
So, why not just target Android 1.5? Unfortunately, applica-
tions built for 1.5 don’t always display correctly on the larger
and smaller screens found on 1.6 phones. Luckily, there’s an
easy way to make your programs compatible with all versions
of Android. See Chapter 13, Write Once, Test Everywhere, on
page 256 for instructions.
Figure 1.5: Running the “Hello, Android” program
Report erratum
this copy is (P1.0 printing, July 2010)

RUNNING ON THE EMULATOR 27
Figure 1.6: Creating an AVD in Eclipse
Report erratum
this copy is (P1.0 printing, July 2010)

RUNNING ON A REAL PHONE 28
Shortening the Turnaround
Starting the emulator is expensive. Think about it this way鈥?br /> when you first turn on your phone, it needs to boot up just like
anycomputersystem.Closingtheemulatorisjustliketurningoff
the phone or pulling the batteries out. So, don’t turn it off!
Leave the emulator window running as long as Eclipse is run-
ning. The next time you start an Android program, Eclipse will
noticetheemulatorisalreadythereandwilljustsenditthenew
program to run.
Let’s Try That Again
Once you have a valid AVD, the Android emulator window will start up
and boot the Android operating system. The first time you do this, it
may take a minute or two, so be patient. You may need to right-click
the project and select Run As > Android Application again. If you see
an error message saying that the application is not responding, select
the option to continue waiting. If you see a key guard screen, swipe it
as directed to unlock.
Eclipse will send a copy of your program to the emulator to execute.
The application screen comes up, and your “Hello, Android” program is
now running (see Figure 1.5, on page 26). That’s it! Congratulations on
your first Android program.
1.4 Running on a Real Phone
Running an Android program on a physical device such as the Droid
or Nexus One during development is almost identical to running it on
the emulator. You need to enable USB debugging on the phone itself
(by starting the Settings application and selecting Applications > Devel-
opment > USB Debugging), install the Android USB device driver if you
haven’t already (Windows only), and then plug the phone into your com-
7
puter using the USB cable that came with the phone.
7. See http://d.android.com/guide/developing/device.html for the latest device driver and
installation instructions.
Report erratum
this copy is (P1.0 printing, July 2010)

FAST-FORWARD >> 29
Close the emulator window if it’s already open. As long as the phone is
plugged in, Eclipse will load and run applications on the phone instead.
When you’re ready to publish your application for others to use, there
are a few more steps you’ll need to take. Chapter 14, Publishing to the
Android Market, on page 271 will cover that in more detail.
1.5 Fast-Forward >>
Thanks to the Eclipse plug-in, creating a skeletal Android program
takes only a few seconds. In Chapter 3, Designing the User Interface, on
page 43, we’ll begin to flesh out that skeleton with a real application鈥攁
Sudoku game. This sample will be used in several chapters to demon-
strate Android’s API.
But before delving into that, you should take a few minutes to read
Chapter 2, Key Concepts, on the following page. Once you grasp the
basic concepts such as activities and life cycles, the rest will be much
easier to understand.
Although the use of Eclipse to develop Android programs is optional, I
highly recommend it. If you’ve never used Eclipse before, you may want
to invest in a quick reference such as the Eclipse IDE Pocket Guide
[Bur05].




]]>
Java 闆嗗悎姒傝堪http://www.tkk7.com/awaycatalongfish/archive/2011/05/04/349504.html涓嶇埍鍚冪尗鐨勯奔涓嶇埍鍚冪尗鐨勯奔Wed, 04 May 2011 08:16:00 GMThttp://www.tkk7.com/awaycatalongfish/archive/2011/05/04/349504.htmlhttp://www.tkk7.com/awaycatalongfish/comments/349504.htmlhttp://www.tkk7.com/awaycatalongfish/archive/2011/05/04/349504.html#Feedback0http://www.tkk7.com/awaycatalongfish/comments/commentRss/349504.htmlhttp://www.tkk7.com/awaycatalongfish/services/trackbacks/349504.html

]]>
主站蜘蛛池模板: 久久精品国产亚洲av影院| 日本成人免费在线| 国产亚洲精品va在线| 日韩在线一区二区三区免费视频 | 在线免费观看h片| 免费大片在线观看网站| 亚洲最大的成人网| 女人18毛片特级一级免费视频| 亚洲精品视频观看| 免费不卡视频一卡二卡| 亚洲高清无在码在线无弹窗| 一区二区三区无码视频免费福利| 4338×亚洲全国最大色成网站| 一级午夜a毛片免费视频| 亚洲第一页日韩专区| 成在线人直播免费视频| gogo全球高清大胆亚洲| 污视频网站免费观看| 国产亚洲AV夜间福利香蕉149| 东方aⅴ免费观看久久av| 亚洲国产精品自在在线观看| 99精品国产成人a∨免费看| 亚洲国产日韩在线成人蜜芽 | 亚洲精品久久久www| 中文字幕无码免费久久9一区9| 亚洲精品你懂的在线观看| 日韩人妻一区二区三区免费| 亚洲Av高清一区二区三区| 日韩黄色免费观看| 一道本在线免费视频| 亚洲AV无一区二区三区久久| 真人做A免费观看| 国产精品亚洲色图| 久久被窝电影亚洲爽爽爽| 在线观看成人免费视频不卡| 亚洲精品天堂成人片AV在线播放| 亚洲熟妇少妇任你躁在线观看无码| 日本免费在线观看| 亚洲欧美日韩中文二区| 久久亚洲精品视频| 免费高清小黄站在线观看|