应用程序基础Android Developers毕业论文英文翻译.doc
《应用程序基础Android Developers毕业论文英文翻译.doc》由会员分享,可在线阅读,更多相关《应用程序基础Android Developers毕业论文英文翻译.doc(14页珍藏版)》请在三一办公上搜索。
1、Application FundamentalsAndroid applications are written in the Java programming language. The compiled Java code along with any data and resource files required by the application is bundled by the aapt tool into an Android package, an archive file marked by an .apk suffix. This file is the vehicle
2、 for distributing the application and installing it on mobile devices; its the file users download to their devices. All the code in a single .apk file is considered to be one application.In many ways, each Android application lives in its own world:1. By default, every application runs in its own L
3、inux process. Android starts the process when any of the applications code needs to be executed, and shuts down the process when its no longer needed and system resources are required by other applications.2. Each process has its own virtual machine (VM), so application code runs in isolation from t
4、he code of all other applications.3. By default, each application is assigned a unique Linux user ID. Permissions are set so that the applications files are visible only to that user and only to the application itself although there are ways to export them to other applications as well.Its possible
5、to arrange for two applications to share the same user ID, in which case they will be able to see each others files. To conserve system resources, applications with the same ID can also arrange to run in the same Linux process, sharing the same VM.Application ComponentsA central feature of Android i
6、s that one application can make use of elements of other applications (provided those applications permit it). For example, if your application needs to display a scrolling list of images and another application has developed a suitable scroller and made it available to others, you can call upon tha
7、t scroller to do the work, rather than develop your own. Your application doesnt incorporate the code of the other application or link to it. Rather, it simply starts up that piece of the other application when the need arises.For this to work, the system must be able to start an application process
8、 when any part of it is needed, and instantiate the Java objects for that part. Therefore, unlike applications on most other systems, Android applications dont have a single entry point for everything in the application (no main() function, for example). Rather, they have essential components that t
9、he system can instantiate and run as needed. There are four types of components:ActivitiesAn activity presents a visual user interface for one focused endeavor the user can undertake. For example, an activity might present a list of menu items users can choose from or it might display photographs al
10、ong with their captions. A text messaging application might have one activity that shows a list of contacts to send messages to, a second activity to write the message to the chosen contact, and other activities to review old messages or change settings. Though they work together to form a cohesive
11、user interface, each activity is independent of the others. Each one is implemented as a subclass of the Activity base class.An application might consist of just one activity or, like the text messaging application just mentioned, it may contain several. What the activities are, and how many there a
12、re depends, of course, on the application and its design. Typically, one of the activities is marked as the first one that should be presented to the user when the application is launched. Moving from one activity to another is accomplished by having the current activity start the next one.Each acti
13、vity is given a default window to draw in. Typically, the window fills the screen, but it might be smaller than the screen and float on top of other windows. An activity can also make use of additional windows for example, a pop-up dialog that calls for a user response in the midst of the activity,
14、or a window that presents users with vital information when they select a particular item on-screen.The visual content of the window is provided by a hierarchy of views objects derived from the base View class. Each view controls a particular rectangular space within the window. Parent views contain
15、 and organize the layout of their children. Leaf views (those at the bottom of the hierarchy) draw in the rectangles they control and respond to user actions directed at that space. Thus, views are where the activitys interaction with the user takes place.For example, a view might display a small im
16、age and initiate an action when the user taps that image. Android has a number of ready-made views that you can use including buttons, text fields, scroll bars, menu items, check boxes, and more.A view hierarchy is placed within an activitys window by the Activity.setContentView() method. The conten
17、t view is the View object at the root of the hierarchy. (See the separate User Interface document for more information on views and the hierarchy.)ServicesA service doesnt have a visual user interface, but rather runs in the background for an indefinite period of time. For example, a service might p
18、lay background music as the user attends to other matters, or it might fetch data over the network or calculate something and provide the result to activities that need it. Each service extends the Service base class.A prime example is a media player playing songs from a play list. The player applic
19、ation would probably have one or more activities that allow the user to choose songs and start playing them. However, the music playback itself would not be handled by an activity because users will expect the music to keep playing even after they leave the player and begin something different. To k
20、eep the music going, the media player activity could start a service to run in the background. The system would then keep the music playback service running even after the activity that started it leaves the screen.Its possible to connect to (bind to) an ongoing service (and start the service if its
21、 not already running). While connected, you can communicate with the service through an interface that the service exposes. For the music service, this interface might allow users to pause, rewind, stop, and restart the playback.Like activities and the other components, services run in the main thre
22、ad of the application process. So that they wont block other components or the user interface, they often spawn another thread for time-consuming tasks (like music playback). See Processes and Threads, later.Broadcast receiversA broadcast receiver is a component that does nothing but receive and rea
23、ct to broadcast announcements. Many broadcasts originate in system code for example, announcements that the timezone has changed, that the battery is low, that a picture has been taken, or that the user changed a language preference. Applications can also initiate broadcasts for example, to let othe
24、r applications know that some data has been downloaded to the device and is available for them to use.An application can have any number of broadcast receivers to respond to any announcements it considers important. All receivers extend the BroadcastReceiver base class.Broadcast receivers do not dis
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 应用程序基础Android Developers 毕业论文英文翻译 应用程序 基础 Android 毕业论文 英文翻译
链接地址:https://www.31ppt.com/p-2394221.html