基于Android手机平台的邮件客户端设计与开发外文翻译资料

 2022-11-14 04:11

Hello, Android

Introducing Googlersquo;s Mobile Development Platform

Android is an open source software toolkit for mobile phones that was created by Google and the Open Handset Alliance. Its inside millions of cell phones and other mobile devices, making Android a major platform for application developers. Whether youre a hobbyist or a professional programmer, whether you are doing it for fun or for profit, its time to learn more about developing for Android. This book will help you get started.

What Makes Android Special?

There are already many mobile platforms on the market today, including Symbian, iPhone, Windows Mobile, BlackBerry, Java Mobile Edition, Linux Mobile (LiMo), and more. When I tell people about Android, their first question is often, Why do we need another mobile standard? Although some of its features have appeared before, Android is the first environment that combines the following:

  1. A truly open, free development platform based on Linux and open source: Handset makers like it because they can use and customize the platform Without paying a royalty. Developers like it because they know that the platform lsquo;has legsrsquo;and is not locked into any one vendor that may go under or be acquired.
  2. A component-based architecture inspired by Internet mashups: Parts of one application can be used in another in ways not originally envisioned by the developer. You can even replace built-in components with your own improved versions. This will unleash a new round of creativity in the mobile space.
  3. Tons ofbuilt-in services out of the box: Location-based services use GPS or cell tower triangulation to let you customize the user experience depending on where you are. A full-powered SQL database lets you harness the power of local storage for occasionally connected computing and synchronization. Browser and map views can be embedded directly in your applications. All these built-in capabilities help raise the bar on functionality while lowering your development costs.
  4. Automatic management of the application life cycle: Programs are isolated from each other by multiple layers of security, which will provide a level of system stability not seen before in smart phones. The end user will no longer have to worry about what applications are active or close some programs so that others can run. Android is optimized for low-power, low-memory devices in a fundamental way that no previous platform has attempted.
  5. High-quality graphics and sound: Smooth, antialiased 2D vector graphics and animation inspired by Flash are melded with 3D- accelerated OpenGL graphics to enable new kinds of games and business applications. Codecs for the most common industry- standard audio and video formats are built right in, including

H.264 (AVC), MP3, and AAC.

  1. Portability across a wide range of current and future hardware: All your programs are written in Java and executed by Androidrsquo;s Dalvik virtual machine, so your code will be portable across ARM, x86, and other architectures. Support for a variety of input methods is included such as keyboard, touch, and trackball. User interfaces can be customized for any screen resolution and orientation.

Android offers a fresh take on the way mobile applications interact with users, along with the technical underpinnings to make it possible. But the best part of Android is the software that you are going to write for it.

Chapter 2 The Big Picture

Letrsquo;s start by taking a look at the overall system architecture—the key layers and components that make up the Android open source software stack.

[Linux Kernel]

Android is built on top of a solid and proven foundation: the Linux kernel. Created by Linus Torvalds in 1991, Linux can be found today in everything from wristwatches to supercomputers. Linux provides the hardware abstraction layer for Android, allowing Android to be ported to a wide variety of platforms in the future.

Internally, Android uses Linux for its memory management, process management, networking, and other operating system services. The Android phone user will never see Linux, and your programs will not make Linux calls directly. As a developer, though, youll need to be aware its there.Some utilities you need during development interact with Linux. For example, the adb shell command[1] will open a Linux shell in which you can enter other commands to run on the device. From there you can examine the Linux file system, view active processes, and so forth, subject to security restrictions.

[Native Libraries]

The next layer above the kernel contains the Android native libraries. These shared libraries are all written in C or C , compiled for the particular hardware architecture used by the phone, and preinstalled by the phone vendor.Some of the most important native libraries include the following:

Surface Manager: Android uses a compositing window manager similar to Vista or Compiz, but its much simpler. Instead of draw ing directly to the screen buffer, your drawing commands go into off-screen bitmaps that are then combined with other bitmaps to form the display the user sees. This lets the system create all sorts of interesting effects such as see-through windows and fancy transitions.

2D and 3D graphics: Two- and three-dimensional elements can be combined in a single user interface with Android. The library will use 3D hardware if the device

has it or a fast software renderer if it doesnrsquo;t.

Media codecs: Android can play video and record and play back audio in a variety of formats including AAC, AVC (H.264), H.263, MP3, and MPEG-4.

SQ

剩余内容已隐藏,支付完成后下载完整资料


Hello, Android

Android是由Google和开放手机联盟创建的用于手机的开源软件工具包。它存在于数以百万计的手机和其他移动设备之中,这使Android成为应用程序开发人员的主要平台。无论你是一个爱好者还是专业程序员,无论你是为了乐趣还是盈利,现在也是时候学习更多关于Android开发。这本书旨在帮助你起步。

是什么使Android具有独特之处?

目前市场上已经有许多移动平台,包括Symbian,iPhone,Windows Mobile,BlackBerry,Java Mobile Edition,Linux Mobile(LiMo)等等。 当我告诉人们关于Android,他们的第一个问题经常,为什么我们需要另一个移动标准? 虽然Android的一些功能之前出现过,但它是第一个兼备以下环境:

(1)基于Linux的免费开源平台:手机制造商喜欢它,因为他们可以使用和定制这个平台而无需支付版税。开发者喜欢它,因为他们知道平台不受任何限制于任何一个可能会破产或被收购的厂商。

(2)基于组件的架构,其灵感来自互联网混搭:能够以不同于开发者初始设想的另一种方式来使用应用的组成部分。你甚至可以用自己的改进版本替换内置组件。这将释放移动领域的新一轮创意。

(3)大量现成的服务:基于位置的服务使用GPS或基站三角测量定位,让你根据设备定位定制用户体验。全功能的SQL数据库可以利用本地存储的功能,设备只需要时不时地联网同步即可。浏览器和地图视图可以直接嵌入到应用程序中。所有这些内置功能都有助于提高应用的功能性,同时降低开发成本。

(4)自动管理应用程序的生命周期:程序通过多层安全性相互隔离,这将提高在智能手机中前所未见的系统稳定性水平。最终用户将不再需要担心哪些应用程序处于活动状态或关闭某些程序以便其他程序可以运行。 Android针对低电量、低内存的设备进行了优化,这基本上是以前的平台没有尝试过的。

(5)高质量的图形和声音:平滑而抗锯齿的2D矢量图形和动画的灵感来自Flash与3D加速的OpenGL图形融合,支持新型游戏和商业应用程序。内置的编/解码器支持常见的工业标准音频和视频格式,包括H.264(AVC),MP3和AAC。

(6)在各种既有和未来硬件上的可移植性:所有程序都是用Java编写的,并由Android的Dalvik虚拟机执行,因此你的代码将可以移植到ARM、x86和其他体系结构。支持各种输入法,如键盘,触摸和轨迹球。用户界面可以针对任何屏幕分辨率和方向进行定制。

Android提供了移动应用程序与用户交互方式的新方式,以及使其成为可能的技术基础。但Android最好的部分是你为之编写的软件。

  1. 总览

让我们开始看看整个系统架构——组成Android开源软件堆栈的关键层和组件。

[Linux内核]

Android是建立在一个坚实而可靠的基础之上:Linux内核。Linux是由Linus Torvalds于1991年创建,到今天广泛引用在从手表到超级计算机各种设备中。Linux为Android提供了硬件抽象层,允许Android在未来移植到各种平台。

在内部,Android使用Linux进行内存管理、进程管理、网络和其他操作系统服务。 Android手机用户永远不会看到Linux,你的程序不会直接进行Linux调用。但作为开发人员,你需要知道它。有些开发过程中需要实用程序与Linux交互。例如,adb shell命令用于打开一个Linux shell,让你可以在其中输入其他命令以在设备上运行。你可以通过它检查Linux文件系统,查看活动进程等,但要受到安全限制。

[原生库]

内核上的下一层包含Android原生库。这些共享库都是用C或C 编写的,针对手机使用的特定硬件架构编译,并由电话供应商预安装。下面是一些重要的原生库:

Surface Manager:Android使用类似于Vista或Compiz的合成窗口管理器,但它更简单。它并非直接绘制到屏幕缓冲区,而是将用户的绘图命令保存在,然后与其他位图组合结合生成用户所看到的效果。这使系统创建各种有趣的效果,如透明窗口和奇特的转换。

2D和3D图形:二维和三维元素可以在Android的单一用户界面中组合。如果设备,库将使用3D硬件有它或一个快速软件渲染器,如果没有。

媒体编解码器:Android可以播放视频,并以各种格式(包括AAC,AVC(H.264),H.263,MP3和MPEG-4)录制和播放音频。

SQL数据库:Android包含轻量级的SQLite数据库引擎,与Firefox和Apple iPhone中使用的数据库相同。你可以在应用程序中将其用于持久存储。

浏览器引擎:为了快速显示HTML内容,Android使用WebKit库。这是Google Chrome浏览器、Apple的Safari浏览器和Apple iPhone中使用的相同引擎。

[Android运行时]

另外,内核的顶层是Android运行时,包括Dalvik虚拟机和核心Java库。Dalvik是Dan Bornstein在Google设计和编写的一个虚拟机(VM)。你的代码将编译为独立于机器的指令,称为字节码,然后由移动设备上的Dalvik VM执行。

[应用框架]

在原生库和运行时之上,你会发现是应用框架层。此层提供将用于创建应用程序的高级构建块。该框架预装了Android,但你也可以根据需要使用自己的组件扩展它。

框架的最重要部分如下:

活动管理器:这控制应用程序的生命周期,并为用户导航维护一个通用的后退栈。

内容提供者:这些对象封装了需要在应用程序之间共享的数据,例如联系人。

资源管理器:资源是指程序中除代码外的其他东西。

位置管理器:Android手机始终知道它在哪里。

通知管理器:诸如到达消息、约会、接近性警告、外来入侵等事件可以以不引人注目的方式被预先发送给用户。

第三章 用户界面设计

可以使用以下两种方法之一来设计用户界面:程序和声明。

程序意味着写在代码中。例如,当你编程一个Swing应用程序时,你编写Java代码来创建和操纵所有的用户界面对象,如JFrame和JButton。因此,Swing是程序化的。

另一方面,声明式设计不涉及任何代码。当你设计一个简单的网页,你使用一种类似于XML的标记语——HTML。它可以描述你想在网页上看到什么,而不是你想如何去做。 HTML是声明性的。

Android试图通过在两种风格中创建用户界面来平衡程序和声明两种方式之间的差距。你可以几乎完全保留在Java代码中,或者你可以几乎完全保留在XML描述符中。如果查找任何Android用户界面组件的文档,你将看到Java API和相同的声明性XML属性,事实上它们做的是同样的事情。

[调试]

你用于在其他平台上调试程序的相同技术同样可以应用于Android。 这包括在日志中打印消息并在调试器中逐步浏览你的程序。

(1)使用日志消息进行调试

Log类提供了几种静态方法来打印Android系统日志的各种严重级别的消息:

Log.e( ):错误

Log.w( ):警告

Log.i( ):信息

Log.d( ):调试

Log.v( ):详情

Log.wtf( ):严重错误

用户永远不会看到此日志,但作为开发人员,你可以通过几种方式查看它。 在Eclipse中,通过选择Window gt; Show View gt; Other... gt; Android gt; LogCat打开LogCat视图。 可以按严重性或通过在方法调用上指定的标记来过滤视图。Android日志在开发过程中有着重要的作用。

(2)使用调试器调试

除了日志消息,你可以使用Eclipse调试器设置断点查看程序的运行状态。

  1. 连接网络

7.1使用意图浏览

使用Android的网络API可做的最简单的事情是打开浏览器显示指定的网页。你可能希望在程序中提供指向主页的链接,或访问某些基于服务器的应用程序(如订购系统)。在Android中,它需要三行代码。

一旦你有一个基本的程序,改变布局文件(res / layout / main.xml),如下:

lt;?xml version='1.0' encoding='utf-8'?gt;

lt;LinearLayout

xmlns:android='http://schemas.android.com/apk/res/androidn android:orientation='horizontal' android:layout_width='fill_parent' android:layout_height='fill_parent'gt;

lt;EditText

android:id='@ id/url_field' android:layout_width='wrap_content' android:layout_height='wrap_content' android:layout_weight='1.0' android:lines='1' android:inputType='textUri' android:imeOptions='actionGo' /gt;

lt;Button

android:id='@ id/go_buttonn android:layout_width='wrap_content' android:layout_height='wrap_content' android:text= n@string/go_button' /gt;

lt;/LinearLayoutgt;

这里定我们义了两个控件,一个EditText控件和一个Button控件。

在EditText上,我们设置android:layout_weight =”1.0”,使文本区域填满按钮左侧的所有水平空间,我们还设置android:lines = “1”将控件的高度限制为一行。请注意,这对用户在此处可以输入的文本数量没有影响,只是限制了它显示的文本量。

Android 1.5引入了对软键盘和其他替代输入法的支持。android:inputType =”textUri”和android:imeOptions =”actionGo”指定了软键盘的外观。他们告诉Android,用“.com”和“/”键输入网址的方式替换标准键盘,并有一个打开网页的Go按钮。

和往常一样,用户可读的文本应该放在资源文件res / values / strings.xml中。

接下来,我们需要在BrowserIntent类中填写onCreate( )方法。这是我们构建用户界面和链接所有的行为的地方。

public void onCreate(Bundle savedInstanceState){

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

// 获取指向各个用户界面元素的句柄

urlText = (EditText) findViewById(R.id.url_field);

goButton = (Button) findViewById(R.id.go_button);

// 设置事件处理程序

goButton.setOnClickListener(new OnClickListener() {

public void onClick(View view) {

Uri uri = Uri.parse(urlText.getText().toString());

Intent intent = new Intent(Intent.ACTION_VIEW, uri);

startActivity(intent);

}

});

在onCreate( )中,我们调用setContentView( )从布局资源中的定义加载视图,然后我们调用findViewById( )来获取我们的两个用户界面控件的句柄。

“Uri uri = Uri.parse(urlText.getText().toString());”

该行将网页的地址检索为字符串(例如,”http://www.android.com”),并将其转换为统一资源标识符(URI)。

注意:尝试此操作时,请不要省略网址”http://”部分。如果你这样做,程序会崩溃,因为Android不知道如何处理地址。在一个实际的程序中,可以在用户省略它时自动添加上。

下一行创建一个新的

剩余内容已隐藏,支付完成后下载完整资料


资料编号:[137073],资料为PDF文档或Word文档,PDF文档可免费转换为Word

原文和译文剩余内容已隐藏,您需要先支付 30元 才能查看原文和译文全部内容!立即支付

以上是毕业论文外文翻译,课题毕业论文、任务书、文献综述、开题报告、程序设计、图纸设计等资料可联系客服协助查找。