《手机软件开发技术》周士凯,唐春玲主编|(epub+azw3+mobi+pdf)电子书下载

图书名称:《手机软件开发技术》

【作 者】周士凯,唐春玲主编
【丛书名】国家骨干高职院校重点建设项目 —— 软件技术专业系列教材
【页 数】 100
【出版社】 重庆:重庆大学出版社 , 2015.02
【ISBN号】978-7-5624-8406-6
【价 格】21.00
【分 类】移动电话机-应用程序-程序设计-职业大学-教材
【参考文献】 周士凯,唐春玲主编. 手机软件开发技术. 重庆:重庆大学出版社, 2015.02.

图书封面:

图书目录:

《手机软件开发技术》内容提要:

本书共分为八个任务,主要内容包括:认识安卓;安卓项目框架与调试;面向对象的安卓程序设计;用户界面基础;安卓本地数据存储;网络数据获取和显示;手机自动化等。

《手机软件开发技术》内容试读

任务

认识安卓

1.1任务目标:认识安卓软件开发,搭建开发环境

【知识目标】

·知道安卓(Andorid)系统的特点与发展状况;

●知道IOS、winphone等主流手机的操作系统;

·能够记住手机软件开发的基本流程。

【技能目标】

。能够在安卓手机上,通过编程显示“hello world”。

1.2任务提出:输出Hello world

【任务描述】

在计算机上的安卓软件开发环境中,编写软件显示字符串“hello world”。

【任务分析】

要完成上面的任务,我们进行分析,得出如下结论:

①在计算机上搭建安卓开发环境。

②在开发环境中创建手机模拟器。

③在开发环境中设计一个小程序显示“hello world”。

由此看来,完成该任务的关键就是在计算机上搭建一个安卓软件开发环境,下面就来一步

一步地完成任务吧

手机软件开发技术

1.3任务实现

1.3.1相关软件的下载与安装,建立安卓开发环境

目前安卓软件开发发展得非常快,新的开发工具也层出不穷,但是最常用的还是基于

Eclipse的ADT(Android Development Tools)和2013年5月16日谷歌公司发布的基于IntelliJIDEA的Android Studio。,两者相对而言,由于ADT使用时间较长,在国内的公司也多是用ADT

进行安卓软件开发,所以本书也主要以ADT作为开发环境进行讲解和演示。开发人员如果能

较好地掌握在ADT下进行软件开发,按照谷歌官方所说的那样,也能很快地迁移到Android

Studio进行开发。

ADT的安装:该开发环境适用于windows平台[JDK+Eclipse(Windows平台)+Android

SDK+ADT],安装的时候分为两个部分,首先是安装JAVA的工作环境,然后是安装安卓的开

发环境。

JAVA安装:下载JDK,建议1.5(5.0)以上的版本。官方网站的下载地址是:http://www.oracle.com/technetwork./java/javase/downloads,/jdk7-downloads-l880260.html,需要根据你的操

作系统选择相应的版本下载后直接进行安装,有部分计算机的操作系统版本较低,在DK安

装完成后,可能会需要修改环境变量,具体修改方法参见安装方式二,在此不再赘述。

安卓开发环境安装:

安装方式一(推荐使用谷歌提供的集成安装):在http:/developer.android.com/sdk/index.html下载ADT,如图1.1所示,该ADT已经集成Eclipse与SDK,传统的安装方法是先安装

Eclipse,再在Eclipse中安装ADT插件和SDK,在配置好JDK的机器上可以直接解压运行,多

数情况下计算机直接下载最新的JDK安装就行了;如果安装失败,具体配置JDK的方法参考

安装方式二,如图12所示,这种安装方式相对简单,并且谷歌官方已把核心组件集成好,相对稳定性和兼容性较好,推荐大家使用。

在下载的时候,注意根据情况选择32位或64位的Windows操作系统,如果你使用的是苹果的MAC操作系统或者LINUX,都可以找到对应的开发环境下载,下载前注意勾选“I haveread and agree with the above terms and conditions”,整个文件大小为400~500MB。

解压后得到如下文件及文件夹,如图l.3所示,其中eclipse文件夹是JAVA的集成开发环

境,SDK是对应的不同版本的安卓框架,比如安卓4.0,安卓2.2,等等,详细介绍见本任务1.6

节拓展与提高。SDK manager.exe则是一个管理SDK的应用程序,由于安卓的版本在不断地更新变化,要让开发环境能够保持与时俱进,就要通过这个应用程序实时地连接网络,下载最

新的SDK。

打开eclipse文件夹,运行eclipse.exe文件,看到如图1.4所示的启动界面,显示是谷歌专

用的ADT开发环境。

安装方式二(传统安装方式):

(1)必须软件

DJAVA JDK SE 1.6 jdk-6u13-windows-i586-p.exe.2

任务1认识安卓

Design

DevelopDistribute

Q1:

ides

Reference

Tools

Google Services

Get the Android SDK

The Android SDK provides you the APl libraries anddeveloper tools necessary to build,test,and debugapps for Android.

If you're a new Android developer.we recommend youdownload the ADT Bundle to quickly start developingapps.It includes the essential Android SDKcomponents and a version of the Eclipse IDE withbuilt-in ADT(Android Developer Tools)to streamlineyour Android app development.

With a single download,the ADT Bundle includeseverything you need to begin developing apps:

Download the SDK

·Eclipse+ADT plugin

ADT Bundle for Windows

◆Android SDK Tools

Android Platform-tools

Thelatest Android platform

The latest Android system image for the emulator

图L.1集成ADT下载

Get the Android SDK

Before installing the Android SDK.you must agree to the following terms and conditions.

3.2 You agree that Google or third parties own all legal right,title and interest in and to the SDK,including any

Intellectual Property Rights that subsist in the SDK."Intellectual Property Rights"means any and all rights underpatent law.copyright law.trade seret law,trademark law.and any and all other proprietary rights Googlereservesall rights not expressly granted to you.

3.3 You may not use the SDK for any purpose not expressly permitted by this License Agreement.Except to theextent required by applicable third party licenses.you may not:(a)copy(except for backup purposes).modify.adapt,redistribute,decompile,reverse engineer,disassemble,or create derivative works of the SDK or any part ofthe SDK:or(b)load any part of the SDK onto a mobile handset or any other hardware device except a personalcomputer,combine any part of the SDK with other software,or distribute any software or device incorporating apart of the SDK.

3.4 You agree that you will not take any actions that may cause or result in the fragmentation of Android,includingbut not limited to distributing.participating in the creation of.or promoting in any way a software development kitderived from the SDK.

3.5 Use,reproduction and distribution of components of the SDK licensed under an open source software licenseare governed solely by the terms of that open source software license and not this License Agreement.

3.6 You agree that the form and nature of the SDK that Google provides may change without prior notice to you and

I have read and agree with the above terms and conditions32-bit 54-bit

Download the SDK ADT Bundle for Windows

图1.2集成ADT下载

2Eclipse 3.4.2 eclipse-java-ganymede-SR2-win32.zip.3Google Android SDK android-sdk-windows-1.5_r1.zip.4ADT-0.9.0 ADT-0.9.0.zip.

(2)安装过程

①安装JAVA JDK SE1.6,设置以下环境变量

3

手机软件开发技术

workplace

SDK

Manager.ex

图1.3集成ADT解压后文件

ANDROID

DEVELOPER

TOOLS

2110556

图1.4启动界面

JAVA_HOME,JAVA_HOME=C:\Program Files Java\jdk1.6.0_13;

JAVA_JRE_HOME,JAVA_JRE_HOME=C:\Program Files\Java\jdk1.6.0_13\jre;JRE_HOME,JRE_HOME=C:\Program Files\Java \jre6;

Android_SDK_HOME,C:\Mobile Phone DEV\Android SDK

CLASSPATH,如:

CLASSPATH=.;%JAVA_HOME%\lib;%JAVA_HOME%\lib tools.jar;%JAVA_HOME%\lib\dt.jar;%JRE_HOME%\lib;%JRE_HOME%\lib \rt.jar;%JAVA_JRE_HOME%\lib:%JAVA_JRE_HOME%\lib\rt.jar.

Path(使用命令行工具必须配置),如:

Path=%Android_SDK_HOME%\tools:%JAVA_HOME%\bin:%JRE_HOME%\bin:%JAVAJRE_HOME%\bin

②解压Eclipse3.4.2。

解压eclipse-java-ganymede--SR2-win32.zip到C:\Eclipse For Android\。

③解压Google Android SDK。

解压android-sdk-windows--l.5_rl.zip到C:\Mobile Phone DEV\Android SDK。

④Eclipse下安装ADT0.9.0。复制ADT-0.9.0.ip到C:\:

打开C:\Eclipse For Android\eclipse..exe;设置工作路径为C:\WorkSpace;

Help→Soft Ware Update→find and install-→Search for new features to install-→Next→New

Archived site-→选中C:\ADT-0.9.0.zip→0K→Finish-→ADT-0.9.0.zin选勾→Next→Accept-一

Next→Finish-→Install All-→Restart“YES”。

任务1认识安卓

⑤设置Google Android SDK路径。

Windows-→preferences-→选中Android-→SDK Location中选择Google Android SDK的安装路径C:\Mobile Phone DEV\Android SDK→OK。

1.3.2创建AVD

开发环境安装完成以后,就可以在里面开发应用程序,同时为了测试程序,要先在开发环

境中创建安卓的模拟器,即AVD,如图1.5、图1.6所示。

Java-Test/src/com/example/test/MyHandlerActivity java-ADT

File Edit Run Source Refactor Navigate Search Project Window Help时·阁喻色同☑~d#,0、留⊙,惜Package Explorer☒

MyHandlerActivity java

日年可

}

图1.5创建安卓设备模拟器

Android Virtual Device Manager

o回x

Android Virtual Devices Device Definitions

List of existing Android Virtual Devices located at CA\Users\Administrator android avdAVD Name

Target Name

Platform API Level CPU/ABI

New.

V2.2

Android 2.2

22

ARM(armeabi)

Edit.

Delete..

Repair..

Details..

Start

Refresh

A valid Android Virtual Device.A repairable Android Virtual Device.

X An Android Virtual Device that failed to load.Click'Details'to see the error.

图1.6创建AVD

(1)使用ADT0.9.1版本,在Eclipse中创建安卓设备模拟器

在软件开发过程中,可以快速地进行调试,如图1.7所示为模拟器启动后的效果图。

(2)在命令行中创建AVD

①如图1.8所示,打开CMD命令行,进入Android SDK tools目录:cdE:\Mobile DEV\An-droid SDK1.5\tools

②如图l.9所示,使用android命令列出target值:android list targets。

③使用android create avd命令来创建AVD.选项:

-t一target新的AVD的Target ID(必须);

手机软件开发技术

山小

000

@●⊙⊙

anD30D5

图1.7模拟器启动后的效果

G可命令提示得

-回x

E:\>cd E:\Mobile DEU\Android_SDK1.5\tools

图1.8命令行中创建AVD

G的命令提京符

回×

E:Mobile DEU\Android_SDKt.5\tools>android list targets

Available Android targets:id:1

Nane:Andreid 1.1

Typo:PlatforaAPI level:2

Skins:G1-T Mohile.HUGA (default>.HUGA-L.HUGA-P.QUGA-L.QUGA-P.QUGA-P-

ASUS.SUSE-HUGA-P

1d:2

Nane:Andreld 1.5

Type:PlatfornAPI level:3

Skine:C1-T Mobile.NUCA (defaule>.HUCA-L.HUCA-P.QUCA-L.QUGA-P.QUCA-P-

SUS.SUSE-HUGA-P

id:3

Nane:Google APIs

Type:Add-0n

Uendor:Google Inc.

Description:Android Google APIs

Based on Android 1.5 (API level 3)

com.google.android.maps (naps.jar)API for Google Maps

Skins:QUGA-P-ASUS.GI-T Mebile.QUGA-P.HUGA-L.HUGA (default>.QUGA-L.HU

GA-P.SUSE-HVGA-P

E:Mobile DEV\Android_SDKI.5\tools>

图19在命令行中输入相关命令

-c一sdcard指向一个共享的SD存储卡的路径或是为新的AVD定制的新SD存储卡的容量大小;

p一path新AVD将被创建的位置路径;

-n—name新AVD的名称(必须);

-f—force强制创建(覆盖已存在的AVD):

-S-

skin新AVD的皮肤。

6

···试读结束···

阅读剩余
THE END