Android应用架构外文翻译

合集下载

【Android开发Design】应用结构 - App Structure

【Android开发Design】应用结构 - App Structure

不同的应用对于界面结构的需求是不同的。

例如:像计算器和相机应用,构建在⼀个主要的 Activity 上,这个单⼀的 Activity 处理各种操作像拨号应用,主要的是在⼏个不同的 Activity 中切换,没有很复杂的导航像 Gmail 和 Google 市场,包括了多个数据视图和复杂的浏览方式您应用的结构主要由内容和展示给用户的功能决定。

基本结构 - General Structure典型的 Android 应用由顶层视图和详细信息/编辑视图组成。

如果显示的东西非常多或者步骤复杂,使用分类目录连接顶层和详细信息。

顶层视图也就是您应用中⼏个操作栏标签的顶层视图。

这些视图可以是对于相同数据的不同展示方式,也可以代表您应用中的不同功能。

分类目录视图分类目录可以进⼀步显示数据。

详细信息/编辑视图在详细信息/编辑视图中,用户将看到全部数据或者进行编辑。

顶层 - Top Level您应用的主页设计需要仔细推敲。

它是⼈们每次启动应用时都会看到的界面,所以应当考虑到新用户和老用户。

考虑⼀下: “哥的用户最想看到的是什么?”,根据这个来设计您的主页。

首先显示内容许多应用的目的是展示内容。

不要使用只有分类导航的界面,而是直接将内容展示在您的主页上,让⼈们可以立即看到。

根据内容选择合适的布局,还要考虑屏幕尺⼨。

电⼦市场的主页上包括应用、音乐、图书、电影和游戏。

同时在界面上展示了丰富多彩的推荐和促销内容。

搜索按钮在操作栏的显著位置。

设计操作栏,用于导航和操作你应用的每⼀个屏幕都要显示操作栏,这样能保持统⼀的浏览体验并且可以显示重要的操作。

对于顶层来说,操作栏的设计需要考虑以下特殊的要求:显示您应用的图标或者标题。

如果顶层由多个视图组成,或者用户经常在不同的账户间切换,那么应当加⼊“视图切换菜单”,方便用户导航。

如果您应用的目的是编写内容,那么考虑从顶层就可以直接访问这些内容。

尽量在操作栏中提供搜索功能,搜索可以节省用户⼤量时间。

Android手机外文翻译---应用程序基础Android Developers

Android手机外文翻译---应用程序基础Android Developers

英文原文及译文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 for distributing the application and installing it on mobile devices; it's 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 Linux process. Android starts the process when any of the application's code needs to be executed, and shuts down the process when it's 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 the code of all other applications.3. By default, each application is assigned a unique Linux user ID. Permissions are set so that the application's 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.It's possible to arrange for two applications to share the same user ID, in which case they will be able to see each other's 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 is 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 that scroller to do the work, rather than develop your own. Your application doesn't 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 when any part of it is needed, and instantiate the Java objects for that part. Therefore, unlike applications on most other systems, Android applications don't have a single entry point for everything in the application (no main() function, for example). Rather, they have essential components that the 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 along 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 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 are 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 activity 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, 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 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 activity's interaction with the user takes place.For example, a view might display a small image 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 activity's window by the Activity.setContentView() method. The content 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 doesn't have a visual user interface, but rather runs in the background for an indefinite period of time. For example, a service might play 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 application 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 keep 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.It's possible to connect to (bind to) an ongoing service (and start the service if it's 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 thread of the application process. So that they won't 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 react 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 other 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 display a user interface. However, they may start an activity in response to the information they receive, or they may use the NotificationManager to alert the user. Notifications can get the user's attention in various ways — flashing the backlight, vibrating the device, playing a sound, and so on. They typically place a persistent icon in the status bar, which users can open to get the message.Content providersA content provider makes a specific set of the application's data available to other applications. The data can be stored in the file system, in an SQLite database, or in any other manner that makes sense. The content provider extends the ContentProvider base class to implement a standard set of methods that enable other applications to retrieve and store data of the type it controls. However, applications donot call these methods directly. Rather they use a ContentResolver object and call its methods instead. A ContentResolver can talk to any content provider; it cooperates with the provider to manage any interprocess communication that's involved.See the separate Content Providers document for more information on using content providers.Whenever there's a request that should be handled by a particular component, Android makes sure that the application process of the component is running, starting it if necessary, and that an appropriate instance of the component is available, creating the instance if necessary.Activating components: intentsContent providers are activated when they're targeted by a request from a ContentResolver. The other three components —activities, services, and broadcast receivers — are activated by asynchronous messages called intents. An intent is an Intent object that holds the content of the message. For activities and services, it names the action being requested and specifies the URI of the data to act on, among other things. For example, it might convey a request for an activity to present an image to the user or let the user edit some text. For broadcast receivers, the Intent object names the action being announced. For example, it might announce to interested parties that the camera button has been pressed.There are separate methods for activating each type of component:1. An activity is launched (or given something new to do) by passing an Intent object toContext.startActivity() or Activity.startActivityForResult(). The responding activity can look at the initial intent that caused it to be launched by calling its getIntent() method. Android calls the activity's onNewIntent() method to pass it any subsequent intents. One activity often starts the next one. If it expects a result back from the activity it's starting, it calls startActivityForResult() instead of startActivity(). For example, if it starts an activity that lets the user pick a photo, it might expect to be returned the chosen photo. The result is returned in an Intent object that's passed to the calling activity's onActivityResult() method.2. A service is started (or new instructions are given to an ongoing service) by passing an Intent object to Context.startService(). Android calls the service's onStart() method and passes it the Intent object. Similarly, an intent can be passed to Context.bindService() to establish an ongoing connection between the calling component and a target service. The service receives the Intent object in an onBind() call. (If the service is not already running, bindService() can optionally start it.) For example, an activity might establish a connection with the music playback service mentioned earlier so that it can provide the user with the means (a user interface) forcontrolling the playback. The activity would call bindService() to set up that connection, and then call methods defined by the service to affect the playback.A later section, Remote procedure calls, has more details about binding to a service.3. An application can initiate a broadcast by passing an Intent object to methods like Context.sendBroadcast(), Context.sendOrderedBroadcast(), and Context.sendStickyBroadcast() in any of their variations.Android delivers the intent to all interested broadcast receivers by calling their onReceive() methods. For more on intent messages, see the separate article, Intents and Intent Filters.Shutting down componentsA content provider is active only while it's responding to a request from a ContentResolver. And a broadcast receiver is active only while it's responding to a broadcast message. So there's no need to explicitly shut down these components.Activities, on the other hand, provide the user interface. They're in a long-running conversation with the user and may remain active, even when idle, as long as the conversation continues. Similarly, services may also remain running for a long time. So Android has methods to shut down activities and services in an orderly way:1. An activity can be shut down by calling its finish() method. One activity can shut down another activity (one it started with startActivityForResult()) by calling finishActivity().2. A service can be stopped by calling its stopSelf() method, or by calling Context.stopService().Components might also be shut down by the system when they are no longer being used or when Android must reclaim memory for more active components. A later section, Component Lifecycles, discusses this possibility and its ramifications in more detail.The manifest fileBefore Android can start an application component, it must learn that the component exists. Therefore, applications declare their components in a manifest file that's bundled into the Android package, the .apk file that also holds the application's code, files, and resources.The manifest is a structured XML file and is always named AndroidManifest.xml for all applications. It does a number of things in addition to declaring the application's components, such as naming any libraries the application needs to be linked against (besides the default Android library) and identifying any permissions the application expects to be granted.But the principal task of the manifest is to inform Android about the application's components. For example, an activity might be declared as follows:The name attribute of the <activity>element names the Activity subclass that implements the activity. The icon and label attributes point to resource files containing an icon and label that can be displayed to users to represent the activity.The other components are declared in a similar way —<service>elements for services, <receiver>elements for broadcast receivers, and <provider>elements for content providers. Activities, services, and content providers that are not declared in the manifest are not visible to the system and are consequently never run. However, broadcast receivers can either be declared in the manifest, or they can be created dynamically in code (as BroadcastReceiver objects)andregistered with the system by calling Context.registerReceiver().For more on how to structure a manifest file for your application, see The Android Manifest.xml File.Intent filtersAn Intent object can explicitly name a target component. If it does, Android finds that component (based on the declarations in the manifest file) and activates it. But if a target is not explicitly named, Android must locate the best component to respond to the intent. It does so by comparing the Intent object to the intent filters of potential targets. A component's intent filters inform Android of the kinds of intents the component is able to handle. Like other essential information about the component, they're declared in the manifest file. Here's an extension of the previous example that adds two intent filters to the activity:The first filter in the example —the combination of the action "android.intent.action.MAIN" and the category"UNCHER" —is a common one. It marks the activity as one that should be represented in the application launcher, the screen listing applications users can launch on the device. In other words, the activity is the entry point for the application, the initial one users would see when they choose the application in the launcher.The second filter declares an action that the activity can perform on a particular type of data.A component can have any number of intent filters, each one declaring a different set of capabilities. If it doesn't have any filters, it can be activated only byintents that explicitly name the component as the target.For a broadcast receiver that's created and registered in code, the intent filter is instantiated directly as an IntentFilter object. All other filters are set up in the manifest.For more on intent filters, see a separate document, Intents and Intent Filters.应用程序基础Android DevelopersAndroid应用程序使用Java编程语言开发。

外文翻译安卓系统的大体描述

外文翻译安卓系统的大体描述

附录二外文文献(原文)The basic of description of android system The mainstream of the next generation of open operating systems will not be on the desktop, but will appear in the phone that we carry every day. Open environment will lead these new applications may be integrated into these online services that already exist, of course, as with growing data services on mobile phones support the security flaws on the phone is also becoming increasingly clear. The nature of the next-generation operating system, whether to provide a complete integrated security platform.By the Open Mobile Alliance (open Handset Alliance led by Google) developed the android system is a widely optimistic about an open source phone system, the system provides a basic operating system, a middle ware application layer, a java development tools and a system Application collector (collection of system applications). The android the SDK since 2007 on the release of the first android phone in October 2020 before the birth. Google opened since then on his own time, Taiwan's HTC, the manufacturer of the T-Mobile G1 estimate G1 shipments have more than one million at the end of 2020. According to industry insiders expect the G1 mobile phone sales in 2020 continue. Many other mobile phone suppliers in the near future plans to support this system.Around an android and a huge developer community has beenestablished, while a lot of new products and applications on the android. Android's main selling point is that it enables developers to seamlessly expand online services to mobile phones. This is the most obvious example is Google's tightly integrated with Gmail, Calendar and Contacts Web applications through the system. Users only need to provide an android user name and password, the phone automatically sync with Google services. The other vendors are quickly adapt their existing instant messaging, social networking and gaming services. Android and many companies find new ways to integrate their existing business to the android.Traditional desktop and server operating system has been working for the integration of security features. These individuals and business applications on a single platform is very good, however a business phone platform like android is not very useful. It gives the hope of many researchers. Android is not parked in the body for other platform application support: the implementation of the application depends on a top-level JAVA middle ware, the middle ware running on the embedded Linux kernel. Therefore, developers should deploy their applications to the Android must use a custom user interface environment.In addition, the android system applications limit the application to call each other API collaboration, and the other to authenticate the user application. Although these applications have certain safety features,some of our experienced developers to create Android applications who revealed that the design of security applications is not always straight forward. Android uses a simple permission label distribution mode to restrict access to resources, but the reasons for the necessity and convenience of other applications, the designers have increased the confusion on this system. This paper attempts to explain the complexity of the Android security, and pay attention to some of the possible development defects and application security. We try to draw some lessons learned, and hope that the safety of the future.Android application framework for developers is a mandatory framework. It does not have a main () function function or a single entry point for the implementation of the contrary, the developer must in the design of application components. We developed applications to help the API of the android sdkThe Android system defines four kinds of component type.Activity component that defines the application user interface. Usually, the application developer defines each activity screen. Activity can start, it may pass and return values. Can be handled at a time only a keyboard system Activity, all other Activity will be suspended at this time.Service components perform background processing. The need for some operations when an activity, after the disappearance of the user interface (such as downloading a file or playing music), it usually takesuch action specially designed services. Developers can also use a special daemon at system startup, the service is usually defined a remote procedure call (RPC), and other system components can be used to send the interface command and retrieve data, as well as to register a callback function.ContentProvider component storage and share data with relational database interfaces. Each Content supplier has an associated "rights" to describe its contents contains. Other components when used as a handle to execute SQL queries (eg SELECT, INSERT, or DELETE content. Content suppliers are typically stored the values on the database records, data retrieval is a special case, the file is also shared by the content provider interface.The components of the broadcast receiver as to send a message from the mailbox to the application. Typically, the broadcast message, the application code implicit destination. Therefore, the radio receiver subscribe to these destinations receive messages sent to it. The application code can also be solved explicitly broadcast receivers, including the name space allocation.The main mechanism of the interaction of the components of the Component Interaction, is an intent, which is a simple message object, which contains a destination address and data components. The Android API defines his approach into intent, and use that information to initiatean activity such as start an activity (startActivity (An intent)) start services (the startService (An intent)) and radio (sendBroadcast (An intent)). Android framework to inform the calls to these methods began to perform in the target application code. This process, the internal components of communication is called an action. Simply put, the Intent object defined in the "Intent to implement the" action ". One of the most powerful features of the Android is allowed a variety of intent addressing mechanism. The developer can solve the space of a target component using its applications, they can also specify an implicit name. In the latter case, the system determines the best components of an action by considering the installed applications and user choice.Implicit name is called the action string because of his special type of the requested action. Such as a view action string, in an intent data field points to an image file, the system will directly referring to the preferred image viewer.Developers can also use the action string a large number of radio to send and receive. Receiver at the receiving end, the developers use an intent filter to customize the special action string. Android Department, including the additional goal of the resolution rules, but an optional string type of data manipulation is the most common.Android applications are written in the Java programming language.The compiled Java code —along with any data and resourcefiles required by the application —is bundled by the apt tool into an Android package,an archive file marked by an .apk suffix.This file is the vehicle for distributing the application and installing it on mobile devices;it's 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 Linux process.Android starts the process when any of the application's code needs to be executed,and shuts down the process when it's 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 the code of all other applications.(3)By default,each application is assigned a unique Linux user ID.Permissions are set so that the application's files are visible only to that user and only to the application itself —altough there are ways to export them to other applications as well.It's possible to arrange for two applications to share the same user ID,in while case they will be able to see each other's 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 is that one application can make use ofelements of other application (provided those application 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 that scroller to do the work,rather than develop your own.Your application doesn't 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 when any part of it is needed,and instantiate the Java objects for that part.Therefore,unlike applications on most other systems,Android applications don't have a single entry point for everything in the application(no main()function,for example).Rather,they have essential components that the 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 along 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 or change settings.Tough they worktogether to form a cohesive 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 are 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 activity 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,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 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 activity'sinteraction with the user takes place.For example,a view might display a small image 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 activity's window by the Activity.setContentView()method.The content 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 doesn't have a visual user interface,but rather runs in the background for an indefinite period of time.For example,a service might play 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 songs from a play list.The player application would probably have one or more activities that allow the user to choose songs and start playing them.However,the music playback itself would bot be handled by an activity because users will expect the music to keep the music going,the media player activity could start a service to run in the background.The system would then keep themusic playback service running even after the activity that started it leaves the screen.It's possible to connect to (bind to)an ongoing service(and start the service if it's 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 thread of the application process.So that they won't block other components or the user interface,they often spawn another thread for time-consuming tasks(like music playback).See Processes and Thread,later.Broadcast receiversA broadcast receiver is a component that does nothing but receive and react 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 other 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 respond to respond to any announcements it considers important.All receivers extend the BroadcastReceiver base class.Broadcast receivers do not display a user interface.However,they may start an activity in response to the information they receive,or they mayuse the NotificationManager to alert the user.Notifications can get the user's attention in various ways — flashing the backlight,vibrating the device,playing a sound,and so on,They typically place a persistent icon in the status bar,which users can open to get the message.Content providersA content provider makes a specific set of the application's data available to other applications.The data can be stored in the file system,in an SQLite database,or in any other manner that makes sense.The content provider extends the ContentProvider base class to implement a standard set of methods that enable other applications to retrieve and store data of the type it controls.However,applications do not call these methods directly.Rather they use a ContentResolver object and call its methods instead.A ContentResolver can talk to any content provider;it cooperates with the provider to manage any interprocess communication that's involved.See the separate Content Providers document for more information on using content providers.Whenever there's a request that should be handled by a particular component,Android makes sure that the application process of the component is running,starting it if necessary,and that an appropriate instance of the component is available,creating the instance if necessary.Activating components:intentsContent providers are activated when they're targeted by a request from a ContentResolver.The other three components —activities,services,and broadcast receivers —are activated by asynchronous messages called intents.An intent is an Intent object that holds the content of the message.For activities and services,it names the action being requested and specifies the URI of the data to act on,amongother things.For example,it might convey a request for an activity to present an image t the user or let the user edit some text.For broadcast receivers,the Intent object names the action being announced.For example,it might announce to interested parties that the camera button has been pressed.There are separate methods for activating each type of component:1.An activity is launched(or given something new to do)by passing an Intent object to Context.startActivity() or Activity.startActivityForResult().The responding activity can look at the initial intent that caused it to be launched by calling its getIntent() method.Android calls the activity's onNewIntent()method to pass it any subsequent intents.One activity often starts the next one.If it expects a result back from the activity it's starting,it calls startActivityForResult() instead of startActivity().For example,if it starts an activity that lets the user pick a photo,it might expect to be returned the chosen photo.The result is returned in an Intent object that's passed to the calling activity's onActivityResult() method.2.A service is started(or new instructions are given to an ongoing service)by passing an Intent object to Context.startService().Android calls the service's onStart() method and passes it the Intent object.Similarly,an intent can be passed to Context.bindService() to establish an ongoing connection between the calling component and a target service.The service receives the Intent object in an onBind() call.(If the service is not already running,bindService() can optionally start it.)For example,an activity might establish a connection with the music playback service mentioned earlier so that it can provide the user with the means(a user interface)for controlling the playback.The activity would call bindService() to set up that connection,and then call methods defined by the service to affect the playback.A later section,Remote procedure calls,has more details about binding to a service.3.An application can initiate a broadcast by passing an Intent object to methods like Context.sendStickyBroadcast() in any of their variations.Android delivers the intent to all interested broadcast receivers by calling their onReceive() methods.For more on intent messages,see the separate article,Intents and Intent Filters.Shutting down componentsA content provider is active only while it's responding to a request from a ContentResolver.And a broadcast receiver is active only while it's responding to a broadcast message.So there's no need to explicitly shut down these components.Activities,on the other hand,provide the user interface.They're in a long-running conversation with the user and may remain active,even when idle,as long time.So Android has methods to shut down activities and services in an orderly way:1.An activity can be shut down by calling its finish() method.Onte activity can shut down another activity (one it started with startActivityForResult())by calling finishActivity().2.A service can be stopped by calling its stopSelf() method,or by calling Context.stopService().Components might also be shut down by the system when they are no longer being used or when Android must reclaim memory for more active components.A later section,Component Lifecycles,discusses this possibility and its ramifications in more detail.The manifest fileBefore Android can start an application component,it must learn that the component exists.Therefore,applications declare their components in a manifest file that's bundled into the Android package,the .apk file that also holds the application's code,files, and resources.The manifest is a structured XML file and is always named AndroidManifest.xml for all applications.It does a number of things in addition to declaring the application's components,such as naming any libraries the application needs to be linked against(besides the default Android library)and identifying any permissions the application expects to be granted.But the principal task of the manifest is to inform Android about the application's components.For example,an activity might be declared as follows:The name attribute of the <activity>element names the Activity subclass that implements the activity.The icon and label attributes point to resource files containing an icon and label that can be displayed to users to resource files containing an icon and label that can be displayed to users to represent the activity.The other components are declared in a similar way —<service>elements for services,<receiver>elements for broadcast receivers,and<provider>elements for content providers.Activities,services,and content providers that are not declared in the manifest are not visible to the system and are consequently never run.However,broadcast receivers can either be declared in themanifest,or they can be created dynamically i code (as BroadcastReceiver objects)and registered with the system by calling Context.registerReceiber().For more on how to structure a manifest file for your application,see The Android Manifest.xml File.Intent filtersAn Intent object can explicitly name a target component.If it does,Android finds that component(based on the declarations in the manifest file)and activates it.But if a target is not explicitly named,Android must locate the best component to respond to the intent.It does s by comparing the Intent object to the intent filters of potential targets.A component's intent filters inform Android of the kinds of intents the component is able to handle.Like other essential information about the component,they're declared in the manifest.Here's an extension of the previous example that adds two intent filters to the activity:The first filter in the example — the combination of the action "android.intent.action.MAIN"and the category "UNCHER"—is a common one.It marks the activity as one that should be represented in the application launcher,thescreen listing applications users can launch on the device.In other words,the activity is the entry point for the application,the initial one users would see when they choose the application in the launcher.The component can have any number of intent filters,each one declaring a different set of capabilities.If it doesn't have any filters,it can be activated only by intents that explicitly name the component as the target.For a broadcast receiver that's created and registered in code,the intent filter is instantiated directly as an IntentFilter object.All other filters are set up in the manifest.For more on intent filters,see a separate document, Intents and Intent Filters.附录三外文文献(译文)安卓系统的大体描述下一代开放操作系统的主流将可不能在桌面上,可是将会出此刻咱们天天携带的电话上。

有关android技术英文文献翻译【最新】

有关android技术英文文献翻译【最新】

英语原文Android Application FundamentalsAndroid applications are written in the Java programming language. The Android SDK tools compile the code—along with any data and resource files—into an Android package, an archive file with an .apk suffix. All the code in a single .apk file is considered to be one application and is the file that Android-powered devices use to install the application.Once installed on a device, each Android application lives in its own security sandbox:●The Android operating system is a multi-user Linux system in which each application is adifferent user.●By default, the system assigns each application a unique Linux user ID (the ID is used onlyby the system and is unknown to the application). The system sets permissions for all thefiles in an application so that only the user ID assigned to that application can access them.●Each process has its own virtual machine (VM), so an application's code runs in isolationfrom other applications.●By default, every application runs in its own Linux process. Android starts the processwhen any of the application's components need to be executed, then shuts down theprocess when it's no longer needed or when the system must recover memory for otherapplications.In this way, the Android system implements the principle of least privilege. That is, each application, by default, has access only to the components that it requires to do its work and no more. This creates a very secure environment in which an application cannot access parts of the system for which it is not given permission.However, there are ways for an application to share data with other applications and for an application to access system services:●It's possible to arrange for two applications to share the same Linux user ID, in which casethey are able to access each other's files. To conserve system resources, applications withthe same user ID can also arrange to run in the same Linux process and share the sameVM (the applications must also be signed with the same certificate).●An application can request permission to access device data such as the user's contacts,SMS messages, the mountable storage (SD card), camera, Bluetooth, and more. Allapplication permissions must be granted by the user at install time.That covers the basics regarding how an Android application exists within the system. The rest of this document introduces you to:●The core framework components that define your application.●The manifest file in which you declare components and required device features for yourapplication.●Resources that are separate from the application code and allow your application togracefully optimize its behavior for a variety of device configurations.Application ComponentsApplication components are the essential building blocks of an Android application. Each component is a different point through which the system can enter your application. Not all components are actual entry points for the user and some depend on each other, but each one exists as its own entity and plays a specific role—each one is a unique building block that helps define your application's overall behavior.There are four different types of application components. Each type serves a distinct purpose and has a distinct lifecycle that defines how the component is created and destroyed.Here are the four types of application components:ActivitiesAn activity represents a single screen with a user interface. For example, an email application might have one activity that shows a list of new emails, another activity to compose an email, and another activity for reading emails. Although the activities work together to form a cohesive user experience in the email application, each one is independent of the others. As such, a different application can start any one of these activities (if the email application allows it). For example, a camera application can start the activity in the emailapplication that composes new mail, in order for the user to share a picture.An activity is implemented as a subclass of Activity and you can learn more about it inthe Activities developer guide.ServicesA service is a component that runs in the background to perform long-running operations orto perform work for remote processes. A service does not provide a user interface. For example, a service might play music in the background while the user is in a different application, or it might fetch data over the network without blocking user interaction with an activity. Another component, such as an activity, can start the service and let it run or bind to it in order to interact with it.A service is implemented as a subclass of Service and you can learn more about it inthe Services developer guide.Content providersA content provider manages a shared set of application data. Y ou can store the data in thefile system, an SQLite database, on the web, or any other persistent storage location your application can access. Through the content provider, other applications can query or even modify the data (if the content provider allows it). For example, the Android system providesa content provider that manages the user's contact information. As such, any application withthe proper permissions can query part of the content provider (such as ContactsContract.Data) to read and write information about a particular person.Content providers are also useful for reading and writing data that is private to your application and not shared. For example, the Note Pad sample application uses a content provider to save notes.A content provider is implemented as a subclass of ContentProvider and must implement astandard set of APIs that enable other applications to perform transactions. For more information, see the Content Providers developer guide.A broadcast receiver is a component that responds to system-wide broadcastannouncements. Many broadcasts originate from the system—for example, a broadcast announcing that the screen has turned off, the battery is low, or a picture was captured.Applications can also initiate broadcasts—for example, to let other applications know that some data has been downloaded to the device and is available for them to use. Although broadcast receivers don't display a user interface, they may create a status bar notification to alert the user when a broadcast event occurs. More commonly, though, a broadcast receiver is just a "gateway" to other components and is intended to do a very minimal amount of work.For instance, it might initiate a service to perform some work based on the event.A broadcast receiver is implemented as a subclass of BroadcastReceiver and eachbroadcast is delivered as an Intent object. For more information, see the BroadcastReceiver class.A unique aspect of the Android system design is that any application can start another application’s component. For example, if you want the user to capture a photo with the device camera, there's probably another application that does that and your application can use it, instead of developing an activity to capture a photo yourself. You don't need to incorporate or even link to the code from the camera application. Instead, you can simply start the activity in the camera application that captures a photo. When complete, the photo is even returned to your application so you can use it. To the user, it seems as if the camera is actually a part of your application.When the system starts a component, it starts the process for that application (if it's not already running) and instantiates the classes needed for the component. For example, if your application starts the activity in the camera application that captures a photo, that activity runs in the process that belongs to the camera application, not in your application's process. Therefore, unlike applications on most other systems, Android applications don't have a single entry point (there'sno main()function, for example).Because the system runs each application in a separate process with file permissions that restrict access to other applications, your application cannot directly activate a component from another application. The Android system, however, can. So, to activate a component in another application,you must deliver a message to the system that specifies your intent to start a particular component. The system then activates the component for you.Activating ComponentsThree of the four component types—activities, services, and broadcast receivers—are activated by an asynchronous message called an intent. Intents bind individual components to each other at runtime (you can think of them as the messengers that request an action from other components), whether the component belongs to your application or another.An intent is created with an Intent object, which defines a message to activate either a specific component or a specific type of component—an intent can be either explicit or implicit, respectively.For activities and services, an intent defines the action to perform (for example, to "view" or "send" something) and may specify the URI of the data to act on (among other things that the component being started might need to know). For example, an intent might convey a request for an activity to show an image or to open a web page. In some cases, you can start an activity to receive a result, in which case, the activity also returns the result in an Intent (for example, you can issue an intent to let the user pick a personal contact and have it returned to you—the return intent includes a URI pointing to the chosen contact).For broadcast receivers, the intent simply defines the announcement being broadcast (for example, a broadcast to indicate the device battery is low includes only a known action string that indicates "battery is low").The other component type, content provider, is not activated by intents. Rather, it is activated when targeted by a request from a ContentResolver. T he content resolver handles all direct transactions with the content provider so that the component that's performing transactions with the provider doesn't need to and instead calls methods on the ContentResolver object. This leaves a layer of abstraction between the content provider and the component requesting information (for security).There are separate methods for activating each type of component:∙Y ou can start an activity (or give it something new to do) by passingan Intent to startActivity() or startActivityForResult() (when you want the activity to return a result).∙Y ou can start a service (or give new instructions to an ongoing service) by passing an Intent to startService(). Or you can bind to the service by passingan Intent to bindService().∙Y ou can initiate a broadcast by passing an Intent to methodslike sendBroadcast(), sendOrderedBroadcast(), or sendStickyBroadcast().∙Y ou can perform a query to a content provider by calling query() on a ContentResolver.For more information about using intents, see the Intents and Intent Filters document. More information about activating specific components is also provided in the followingdocuments: Activities, Services, BroadcastReceiver and Content Providers.Declaring componentsThe primary task of the manifest is to inform the system about the application's components. For example, a manifest file can declare an activity as follows:In the <application> element, the android:icon attribute points to resources for an icon that identifies the application.In the <activity> element, the android:name at tribute specifies the fu lly qualified class name of the Activity subclass and the android:label attributes specifies a string to use as the user-visible label for the activity.You must declare all application components this way:●<activity>elements for activities●<service> elements for services●<receiver>elements for broadcast receivers●<provider>elements for content providersActivities, services, and content providers that you include in your source but do not declare in the manifest are not visible to the system and, consequently, can never run. However, broadcast receivers can be either declared in the manifest or created dynamically in code(as BroadcastReceiver objects) and registered with the system by calling registerReceiver().Declaring component capabilitiesAs discussed above, in Activating Components, you can use an Intent to start activities, services, and broadcast receivers. You can do so by explicitly naming the target component (using the component class name) in the intent. However, the real power of intents lies in the concept of intent actions. With intent actions, you simply describe the type of action you want to perform (and optionally, the data upon which you’d like to perform the action) and allow the system to find a component on the device that can perform the action and start it. If there are multiple components that can perform the action described by the intent, then the user selects which one to use.The way the system identifies the components that can respond to an intent is by comparing the intent received to the intent filters provided in the manifest file of other applications on the device.When you declare a component in your application's manifest, you can optionally include intent filters that declare the capabilities of the component so it can respond to intents from other applications. You can declare an intent filter for your component by adding an <intent-filter>element as a child of the component's declaration element.For example, an email application with an activity for composing a new email might declare an intent filter in its manifest entry to respond to "send" intents (in order to send email). An activity in your application can then create an intent with the “send” action (ACTION_SEND), which the system matches to the email application’s “send” activity and launches it when you invoke the intent with startActivity().For more about creating intent filters, see the Intents and Intent Filters document.Declaring application requirementsThere are a variety of devices powered by Android and not all of them provide the same features and capabilities. In order to prevent your application from being installed on devices that lack features needed by your application, it's important that you clearly define a profile for the types of devices your application supports by declaring device and software requirements in your manifest file. Most of these declarations are informational only and the system does not read them, but external services such as Google Play do read them in order to provide filtering for users when they search for applications from their device.For example, if your application requires a camera and uses APIs introduced in Android 2.1 (API Level 7), you should declare these as requirements in your manifest file. That way, devices that do not have a camera and have an Android version lower than 2.1 cannot install your application from Google Play.However, you can also declare that your application uses the camera, but does not require it. In that case, your application must perform a check at runtime to determine if the device has a camera and disable any features that use the camera if one is not available.Here are some of the important device characteristics that you should consider as you design and develop your application:Screen size and densityIn order to categorize devices by their screen type, Android defines two characteristics for each device: screen size (the physical dimensions of the screen) and screen density (the physical density of the pixels on the screen, or dpi—dots per inch). To simplify all thedifferent types of screen configurations, the Android system generalizes them into select groups that make them easier to target.The screen sizes are: small, normal, large, and extra large.The screen densities are: low density, medium density, high density, and extra high density.By default, your application is compatible with all screen sizes and densities, because theAndroid system makes the appropriate adjustments to your UI layout and image resources.However, you should create specialized layouts for certain screen sizes and providespecialized images for certain densities, using alternative layout resources, and by declaring in your manifest exactly which screen sizes your application supports withthe <supports-screens> element.For more information, see the Supporting Multiple Screens document.Input configurationsMany devices provide a different type of user input mechanism, such as a hardware keyboard, a trackball, or a five-way navigation pad. If your application requires a particular kind of input hardware, then you should declare it in your manifest with the <uses-configuration> e lement. However, it is rare that an application should require a certain input configuration.Device featuresThere are many hardware and software features that may or may not exist on a given Android-powered device, such as a camera, a light sensor, bluetooth, a certain version of OpenGL, or the fidelity of the touchscreen. Y ou should never assume that a certain feature is available on all Android-powered devices (other than the availability of the standard Android library), so you should declare any features used by your application with the <uses-feature> element.Platform VersionDifferent Android-powered devices often run different versions of the Android platform, such as Android 1.6 or Android 2.3. Each successive version often includes additional APIs not available in the previous version. In order to indicate which set of APIs are available, eachplatform version specifies an API Level (for example, Android 1.0 is API Level 1 and Android 2.3 is API Level 9). If you use any APIs that were added to the platform after version 1.0, you should declare the minimum API Level in which those APIs were introduced using the <uses-sdk> element.It's important that you declare all such requirements for your application, because, when you distribute your application on Google Play, the store uses these declarations to filter which applications are available on each device. As such, your application should be available only to devices that meet all your application requirements.For more information about how Google Play filters applications based on these (and other) requirements, see the Filters on Google Play document.Application ResourcesAn Android application is composed of more than just code—it requires resources that are separate from the source code, such as images, audio files, and anything relating to the visual presentation of the application. For example, you should define animations, menus, styles, colors, and the layout of activity user interfaces with XML files. Using application resources makes it easy to update various characteristics of your application without modifying code and—by providing sets of alternative resources—enables you to optimize your application for a variety of device configurations (such as different languages and screen sizes).For every resource that you include in your Android project, the SDK build tools define a unique integer ID, which you can use to reference the resource from your application code or from other resources defined in XML. For example, if your application c ontains an image filenamed logo.png (saved in the res/drawable/ directory), the SDK tools generate a resource ID named R.drawable.logo, which you can use to reference the image and insert it in your user interface.One of the most important aspects of providing resources separate from your source code is the ability for you to provide alternative resources for different device configurations. For example, by defining UI strings in XML, you can translate the strings into other languages and save those strings in separate files. Then, based on a language qualifier that you append to the resource directory's name(such as res/values-fr/for French string values) and the user's language setting, the Android system applies the appropriate language strings to your UI.Android supports many different qualifiers for your alternative resources. The qualifier is a short string that you include in the name of your resource directories in order to define the device configuration for which those resources should be used. As another example, you should often create different layouts for your activities, depending on the device's screen orientation and size. For example, when the device screen is in portrait orientation (tall), you might want a layout with buttons to be vertical, but when the screen is in landscape orientation (wide), the buttons should be aligned horizontally. To change the layout depending on the orientation, you can define two different layouts and apply the appropriate qualifier to each layout's directory name. Then, the system automatically applies the appropriate layout depending on the current device orientation.For more about the different kinds of resources you can include in your application and how to create alternative resources for various device configurations, see the ApplicationResources developer guide.中文译文安卓应用基础在Java编程语言编写的Android应用程序的Android的SDK工具编译代码以及与任何数据和到一个Android的包,一个归档文件档案资源的.apk后缀,所有的在一个单一的代码.apk文件被认为是一个应用程序,是Android的文件,供电设备来安装应用程序。

Android应用基础毕设论文外文翻译

Android应用基础毕设论文外文翻译

Android应用基础毕设论文外文翻译Android ns are developed using the Java programming language。

The Android SDK tools are used to compile the code。

data。

and resource files into an Android package。

which is an archive file with an。

apk n。

A single。

apk file contains all the code for an n and is used by Android-powered devices to install the n.After n。

each Android n XXX。

The Android operating system is a multi-user Linux system。

and each n is treated as a separate user。

By default。

the system assigns a unique Linux user ID to each n。

which is only known to the system and not to the n。

The system sets ns for all files in an n。

so that only the user ID assigned to that n can access them.Furthermore。

each process has its own virtual machine (VM)。

which means that an n's code XXX that an n's code cannot interfere with the code of other ns.By default。

Android 2.3系统APK程序中英文对照

Android 2.3系统APK程序中英文对照

谷歌Android内置APK程序中英文对照表AccountAndSyncSettings.apk 同步与帐户设定同步功能【不用可删】删除后点击设置中-帐户同步会出错ADWLauncher.apk 【ADW桌面/换第三方可删】-一定要安装了第三方后才能删除Androidian.apk 【主题文件不用可删】AndroidTerm.apk 【终端模拟器不用可删】ApplicationsProvider.apk 【应用程序支持服务储存/保留】Bluetooth.apk 【蓝牙不用可删(删了就没有蓝牙了)/换第三方可删】Browser.apk 【谷歌浏览器(喜欢UC的可用UC替代)/换第三方可删】Calculator.apk 【计算器(自带计算器较弱,可用其他替代)可删】Calendar.apk 【日历/(不用日历的可删)换第三方可删】CalendarProvider.apk 【日历储存日历程序支持服务(不用日历的可删)可删】Camera.apk 【照相机/换第三方可删】CertInstaller.apk 【证书服务证书安装/貌似没用可删/暂无副作用】CMParts.apk 【CM设置/保留】touchpal输入法拼音语言包(可删)-ChtPack.apk touchpal输入法注音语言包(从来不用注音的删)CMWallpapers.apk 【CM壁纸/可删】CMScreenshot.apk 【CM7的截屏工具.对于不能在电脑上截图的情况来说是非常有用的.需要截图的时候按住关机键选择Screenshot即可截图图片保存在SD/DCIM/Screenshot中】Contacts.apk 【联系人通讯录/换第三方可删】ContactsProvider.apk 【联系人服务通讯录/联系人数据存储服务/保留】Cyanbread.apk 【主题文件不用可删】DefaultContainerService.apk 【默认通讯录服务/楼主惨剧证明必须保留不然无法安装apk包!/】DeskClock.apk 【闹钟不用可删自带闹钟(用第三方闹钟的可删)】Development.apk 【啥玩意开发/可删】开发者工具,的确可删DownloadProviderUi.apk 【啥玩意下载插件/可删】最好不删除DownloadProvider.apk 【下载管理器/可删】最好不删除DrmProvider.apk 【DRM受保护数据存储服务/保留】DSPManager.apk 【均衡器/可删/音乐功能很强大!】Email.apk 【电子邮件Email(不用自带email接受邮件的可删)/可删】-facebook.apk facebook(用不到的删)fmradio.apk 收音机(可删)FileManager.apk 【OI文件管理器可删系统内还有RE】FOTAKill.apk 【防止OTA更新,删与不删随意】FM.apk 【收音机可删】《-没这个东西Gallery3D.apk 【3d图库/卡得一B强烈建议删除!!!】(在这里楼主建议不删..百度了一下这东西.发现有人删除后图片出问题)Gallery.apk 相机相框(可删)GoMarket.apk 【安智市场/可删】GenieWidget.apk 天气与新闻(我自己不用他看新闻,删了)Gmail.apk Gmail邮件(可删)GoogleBackupTransport.apk 谷歌备份(可删)GoogleCalendarSyncAdapter.apk 谷歌日历同步适配器(可删)GoogleContactsSyncAdapter.apk 谷歌联系人同步适配器(可删)GoogleFeedback.apk 谷歌反馈(可删)GooglePartnerSetup.apk Google合作伙伴设置(可删)GoogleQuickSearchBox.apk 谷歌搜索(删了影响到桌面的搜索插件)GoogleServicesFramework.apk 谷歌同步支持服务框架(删了不能同步联系人,不能登录google)HTMLViewer.apk 【HTML浏览器(本地看html,用不到可删)】HWCalla_TaiWan.apk 繁体中文手写输入法(可写简体的,不用手写的可删)LatinIME.apk 【android键盘输入法(可删) 无中文删之】LatinImeTutorial.apk android键盘输入法设置(可删) LiveWallpapersPicker.apk 【动态壁纸选择删吧】这个是动态壁纸功能,最好不删除LiveWallpapers.apk 【动态壁纸同删】动态壁纸Launcher2.apk 2.2原生桌面(用ADW和PRO的可删,删了以后第三方桌面要在开机以后从电脑安装,91,豌豆助手都可)LauncherPro.apk 【桌面.可用其他桌面代替】MagicSmokeWallpapers.apk 【魔幻烟雾壁纸完全不晓得是啥子东西删之】MediaProvider.apk 【媒体数据存储服务这个是不可以删除的如果你删除了你的3D图库不能加载你卡上的图片音乐播放器不能加载卡上的音乐文件】Mms.apk 【自带信息(可删,用第三方短信的就删了吧,提示:删了后,用handsms的的弹出短信框会变得延时,chomp没自带短信甚至不能使用把原装短信mms删了会收不到短信。

Android外文文献翻译11

Android外文文献翻译11

Android Application Fundamentals nguage pil.th.code—alon.wit.an.dat.an.resourc.files—int.an Androi.package.a.archiv.an .apk suffix.Al.th.cod.i..single .apk.considere.t.b.on. applicatio.an.i.th..t.instal.th.application.Once installed on a device, each Android application lives in its own security sandbox:The Android operating system is a multi-user Linux system in which each application is a different user.e .I.(e.onl.b.th.syste.an.i.unknow.t.th.application). Th.syste.set.permission.fo.al.th.file.i.a.applicatio.s.tha.o e.I.assigne.t.tha.applicatio.ca.acces.them.Each process has its own virtual machine (VM), so an application's code runs in isolation from other applications.B.default.ever.applicatio.run.i.it.ow.Linu.process.Androi.st art.th.proces.whe.an.o.th.application'.component.nee.t.b.exe cuted.the.shut.dow.th.proces.whe.it'.n.longe.neede.o.whe.th. syste.mus.recove.memor.fo.othe.applications.I.thi.way.th.Androi.syste.implement.the principl.o.leas.pri vilege.Tha.is.eac.application.b.default.ha.acces.onl.t.th.co mponent.tha.i.require.t.d.it.wor.an.n.more.Thi.create..ver.s ecur.environmen.i.whic.a.applicatio.canno.acces.part.o.th.sy ste.fo.whic.i.i.no.give.permission.However, there are ways for an application to share data with other applications and for an application to access system services:It'.possibl.t.arrang.fo.tw.application.t.shar.th.sam.Lin e.ID.i.whic.cas.the.ar.abl.t.acces.eac.other'.files.T.co e.I.ca.als.ar rang.t.ru.i.th.sam.Linu.proces.an.shar.th.sam.V.(th.applicat ion.mus.als.b.signe.wit.th.sam.certificate).A.applicatio.ca.reques.permissio.t.acces.devic.dat.suc.a.th. user'.contacts.SM.messages.th.mountabl.storag.(S.card).camer a.Bluetooth.an.more.Al.applicatio.permission.mus.b.grante.b. e.a.instal.time.Tha.cover.th.basic.regardin.ho.a.Androi.applicatio.exist .withi.th.system.Th.res.o.thi.documen.introduce.yo.to:1.The core framework components that define your application.2.The manifest which you declare components and required device features for your application.3、Resource.tha.ar.separat.fro.th.applicatio.cod.an.allo.you.ap plicatio.t.gracefull.optimiz.it.behavio.fo..variet.o.devic.c onfigurations.Application Componentsponent.ar.th.essentia.buildin.block.o.a. ponen.i..differen.poin.throug.whic ponent.ar.actua.e e.an.som.depen.o.eac.other.bu.eac.on.exist .a.it.ow.entit.an.play..specifi.role—eac.on.i..uniqu.buildin.bloc.tha.help.defin.you.application' .overal.behavior.ponents.Eac.ty p.serve..distinc.purpos.an.ha..distinc.lifecycl.tha.define.h ponen.i.create.an.destroyed.Here are the four types of application components: ActivitiesAn activity e.interface. Fo.example.a.emai.applicatio.migh.hav.on.activit.tha.show..l pos.a.email.an.anothe.activit.fo.readin.emails.Althoug.th.activitie.wor.togethe.t.for e.experienc.i.th.emai.application.eac.on.i.indep enden.o.th.others.A.such..differen.applicatio.ca.star.an.on. o.thes.activitie.(i.th.emai.applicatio.allow.it).Fo.example. .camer.applicatio.ca.star.th.activit.i.th.emai.applicatio.th e.t.shar..picture.An activity is implemented as a subclass of Activity and you can learn more about it in the Activities developer guide. ServicesA service ponen.tha.run.i.th.backgroun.t.perfor. long-runnin.operation.o.t.perfor.wor.fo.remot.processes..ser e.interface.Fo.example..servic.migh.pla e.i.i..differen.application.o e.interactio ponent.suc.a.a.activity.ca.star.th .servic.an.le.i.ru.o.bin.t.i.i.orde.t.interac.wit.it.A service is implemented as a subclass of Service and you can learn more about it in the Services developer guide. Content providersA conten.provider manage..share.se.o.applicatio.data.Y o.ca.stor.th.dat.i.th..a.SQLit.database.o.th.web.o.an.othe.p ersisten.storag.locatio.you.applicatio.ca.access.Throug.th.conten.provider.othe.application.ca.quer.o.eve.modif.th.dat.( i.th.conten.provide.allow.it).Fo.example.th.Androi.syste.pro er'rmation.A.such.an.applicatio.wit.th.prope.permission.ca.quer.par.o.t h.conten.provide.(suc.as ContactsContract.Data.t.rea.an.wri rmatio.abou..particula.person.efu.fo.readin.an.writin.dat.tha .i.privat.t.you.applicatio.an.no.shared.Fo.example.the Not. Pad e..conten.provide.t.sav.notes..conten.provide.i.implemente.a..subclas.of ContentProvider an.mus.implemen..standar.se.o.API.tha.enabl.othe.applicati rmation.se.the Conten.P roviders develope.guide.Broadcast receiversA broadcas.receiver ponen.tha.respond.t.system-w id.broadcas.announcements.Man.broadcast.originat.fro.th.syst em—fo.example..broadcas.announcin.tha.th.scree.ha.turne.off.th. batter.i.low.o..pictur.wa.captured.Application.ca.als.initia t.broadcasts—fo.example.t.le.othe.application.kno.tha.som.dat.ha.bee.down e.Althoug.broadcas .receiver.don'e.interface.the.may creat..statu.ba.notification e.whe..broadcas.even.occurs.Mor. commonly.though..broadcas.receive.i.jus.." ponent.an.i.intende.t.d..ver.minima.amoun.o.work.Fo.instance .i.migh.initiat..servic.t.perfor.som.wor.base.o.th.event. .broadcas.receive.i.implemente.a..subclas.of BroadcastRecei ver an.eac.broadcas.i.delivere.a.an Intent object.Fo.mor. information.se.th.BroadcastReceiver class..uniqu.aspec.o.th.Androi.syste.desig.i.tha.an.applicatio. ca.star.anothe.application’.component.Fo.example.i.yo.wan.t e.t.captur..phot.wit.th.devic.camera.there'.probabl.anot .it.instea. o.developin.a.activit.t.captur..phot.yourself.Yo.don'.nee.t. incorporat.o.eve.lin.t.th.cod.fro.th.camer.application.Inste ad.yo.ca.simpl.star.th.activit.i.th.camer.applicatio.tha.cap plete.th.phot.i.eve.returne.t.you.applica er.i.seem.a.i.th.camer.i.actuall..p ar.o.you.application.ponent.i.start.th.proces.fo.tha.ap plicatio.(i.it'.no.alread.running.an.instantiate.th.classe.n ponent.Fo.example.i.you.applicatio.start.th.ac tivit.i.th.camer.applicatio.tha.capture..photo.tha.activit.r un.i.th.proces.tha.belong.t.th.camer.application.no.i.you.application'.process.Therefore.unlik.application.o.mos.othe.sy stems.Androi.application.don'.hav..singl.entr.poin.(there'.n o main() function.fo.example).Becaus.th.syste.run.eac.applicatio.i..separat.proces.wit. tha.restric.acces.t.othe.applications.you.applicatio.canno.d ponen.fro.anothe.application.Th.Androi.sy ponen.i.anothe.application .yo.mus.delive..messag.t.th.syste.tha.specifie.your intent ponen.fo.you.Activating Componentsponen.types—activities.services.an.broadcas.receivers—ar.activate.b.a.asynchronou.messag.calle.an intent.Intent.b ponent.t.eac.othe.a.runtim.(yo.ca.thin.o.the ponents).whet ponen.belong.t.you.applicatio.o.another.An intent is created with an Intent object, which defines a message to activate either a specific component or a specific type of component—an intent can be either explicit or implicit, respectively.Fo.activitie.an.services.a.inten.define.th.actio.t.perfor .(fo.example.t."view.o."send.something.an.ma.specif.th.UR.o. th.dat.t.ac.o.(ponen.bein.starte.m igh.nee.t.know).Fo.example.a.inten.migh.conve..reques.fo.a.a ctivit.t.sho.a.imag.o.t.ope..we.page.I.som.cases.yo.ca.star.a.activit.t.receiv..result.i.whic.case.th.activit.als.return .th.resul.i.an Intent (fo.example.yo.ca.issu.a.inten.t.le. e.pic..persona.contac.an.hav.i.returne.t.you—th.retur.inten.include..UR.pointin.t.th.chose.contact).For broadcast receivers, the intent simply defines the announcement being broadcast (for example, a broadcast to indicate the device battery is low includes only a known action string that indicates "battery is low").ponen.type.conten.provider.i.no.activate.b. intents.Rather.i.i.activate.whe.targete.b..reques.fro.a Con tentResolver.Th.conten.resolve.handle.al.direc.transaction.w ponen.that'.performin.trans action.wit.th.provide.doesn'.nee.t.an.instea.call.method.o.t he ContentResolver ye.o.abstractio.bet rmatio.(f o.security).There are separate methods for activating each type of component:You can start an activity (or give it something new to do) by passingan Intent to startActivity()or startActivityForResult( )(when you want the activity to return a result).Yo.ca.star..servic.(o.giv.ne.instruction.t.a.ongoin.serv ice.b.passin.an Intent to startService().O.yo.ca.bin.t.th .servic.b.passin.an Intent tobindService().You can initiate a broadcast by passing an Intent to methods like sendBroadcast(), sendOrderedBroadcast(),or sendStickyBroadcast().You can perform a query to a content provider bycalling query()on a ContentResolver.in.intents.se.the Intent.an.Inten .Filters ponent.i.als.provide.i.th.followin.documents: Activities, Services, BroadcastReceiver and Conten.Providers.Declaring components<?xm.version="1.0.encoding="utf-8"?><manifes....>..<applicatio.android:icon="@drawable/app_icon.png....> ....<activit.android:name="com.example.project.ExampleActivi ty".........android:label="@string/example_label....>....</activity>.........</application></manifest>In the <application>element, theandroid:icon attribute points to resources for an icon that identifies the application.In the <activity>element, the android:name at tribute specifies the fu lly qualified class name of theActivity subclass and the android:label attributes specifies a string to use as the user-visible label for the activity.You must declare all application components this way:1.<activity> elements for activities2.<service> elements for services3.<receiver> elements for broadcast receivers4.<provider> elements for content providersActivities.services.an.conten.provider.tha.yo.includ.i.yo u.sourc.bu.d.no.declar.i.th.manifes.ar.no.visibl.t.th.syste. and.consequently.ca.neve.run.However.broadcas.receiver.ca.b. eithe.declare.i.th.manifes.o.create.dynamicall.i.cod.(as Br oadcastReceiver objects.an.registere.wit.th.syste.b.callingregisterReceiver().Declaring component capabilitiesA.discusse.above.in .an In tent t.star.activities.services.an.broadcas.receivers.Yo.ca ponen.(ponen.c .i.th.intent.However.th.rea.powe.o.intent.lie.i.th.c oncep.o.inten.actions.Wit.inten.actions.yo.simpl.describ.th. typ.o.actio.yo.wan.t.perfor.(an.optionally.th.dat.upo.whic.y ou’ponen .o.th.devic.tha.ca.perfor.th.actio.an.star.it.I.ther.ar.mult ponent.tha.ca.perfor.th.actio.describe.b.th.intent.th e.The way the system identifies the components that can respond to an intent is by comparing the intent received to the intent filters provided in the manifest other applications on the device.ponen.i.you.application'.manifest.yo.ca .optionall.includ.inten.filter.tha.declar.th.capabilitie.o.t ponen.s.i.ca.respon.t.intent.fro.othe.applications.Yo.c ponen.b.addin.an <intent-f ilter> ponent'.declaratio.element.posin..n e.emai.migh.declar.a.inten.filte.i.it.manifes.entr.t.respon. t."send.intent.(i.orde.t.sen.email).A.activit.i.you.applicat io.ca.the.creat.a.inten.wit.th.“send.actio.(ACTION_SEND).whic.th.syste.matche.t.th.emai.ap plication’.“unche.i.whe.yo.invok.th.inten.with star tActivity().For more about creating intent filters, see the Intents and Intent Filters document.Declaring application requirementsTher.ar..variet.o.device.powere.b.Androi.an.no.al.o.the.p rovid.th.sam.feature.an.capabilities.I.orde.t.preven.you.app c.feature.neede.b.y ou.application.it'.importan.tha.yo.clearl.defin..pr.th.type. o.device.you.applicatio.support.b.declarin.devic.an.softwar. requirement.i.you.manifes.file.Mos.o.thes.declaration.ar.informationa.onl.an.th.syste.doe.no.rea.them.bu.externa.service er. whe.the.searc.fo.application.fro.thei.device.e.API.int roduce.i.Androi.2..(AP.Level 7).yo.shoul.declar.thes.a.requ irement.i.you.manifes.file.Tha.way.device.tha.do not hav.. camer.an.hav.a.Androi.version lower tha.2..canno.instal.yo u.applicatio.fro.Googl.Play.e.th.camera .bu.doe.not require it.I.tha.case.you.applicatio.mus.perfo r..chec.a.runtim.t.determin.i.th.devic.ha..camer.an.disabl.a .th.camer.i.on.i.no.available.Here are some of the important device characteristics that you should consider as you design and develop your application: Screen size and densityI.orde.t.categoriz.device.b.thei.scree.type.Androi.defin e.tw.characteristic.fo.eac.device.scree.siz.(th.physica.dime nsion.o.th.screen.an.scree.densit.(th.physica.densit.o.th.pi xel.o.th.screen.o.dpi—dot.pe.inch).T.simplif.al.th.differen.type.o.scree.configura tions.th.Androi.syste.generalize.the.int.selec.group.tha.mak .the.easie.t.target.The screen sizes are: small, normal, large, and extra large. The screen densities are: low density, medium density, high density, and extra high density.patibl.wit.al.scree.size.a n.densities.becaus.th.Androi.syste.make.th.appropriat.adjust you.an.imag.resources.However.yo.shoul.creat. yout.fo.certai.scree.size.an.provid.specialize. you.resources.an .b.declarin.i.you.manifes.exactl.whic.scree.size.you.applica tio.support.wit.the <supports-screens> element.For more information, see the Supporting Multiple Screens document.Input configurationse.inpu.mechanism.suc.a.. hardwar.keyboard..trackball.o..five-wa.navigatio.pad.I.you.a pplicatio.require..particula.kin.o.inpu.hardware.the.yo.shou l.declar.i.i.you.manifes.wit.the <uses-configuration> elem ent.However.i.i.rar.tha.a.applicatio.shoul.requir..certai.in pu.configuration.Device featuresTher.ar.man.hardwar.an.softwar.feature.tha.ma.o.ma.no.exis.o ..give.Android-powere.device.suc.a..camera..ligh.sensor.blue tooth..certai.versio.o.OpenGL.o.th.fidelit.o.th.touchscreen.Yo.shoul.neve.assum.tha..certai.featur.i.availabl.o.al.Andro id-powere.device.(othe.tha.th.availabilit.o.th.standar.Andro i.library)e.b.you.applicatio .wit.the <uses-feature> element.Platform VersionDifferen.Android-powere.device.ofte.ru.differen.version.o.th .Androi.platform.suc.a.Androi.1..o.Androi.2.3.Eac.successiv. versio.ofte.include.additiona.API.no.availabl.i.th.previou.v ersion.I.orde.t.indicat.whic.se.o.API.ar.available.eac.platf or.versio.specifie.an AP.Level (fo.example.Androi.1..i.AP. Leve..an.Androi.2..i.AP.Leve.9).an.API.tha.wer.adde. t.th.platfor.afte.versio.1.0.yo.shoul.declar.th.minimu.AP.Le in.the <uses-sdk> eleme nt.It'.importan.tha.yo.declar.al.suc.requirement.fo.you.appl ication.because.whe.yo.distribut.you.applicatio.o.Googl.Play e.thes.declaration.t.filte.whic.application.ar.av ailabl.o.eac.device.A.such.you.applicatio.shoul.b.availabl.o nl.t.device.tha.mee.al.you.applicatio.requirements.For more information about how Google Play filters applications based on these (and other) requirements, see the Filters on Google Play document.Application Resourcespose.o.mor.tha.jus.code—i.require.resource.tha.ar.separat.fro.th.sourc.code.suc.a.im ages.audi.files.an.anythin.relatin.t.th.visua.presentatio.o. th.application.Fo.example.yo.shoul.defin.animations.menus.st e.interface.wit.XM.files .Usin.applicatio.resource.make.i.eas.t.updat.variou.characte ristic.o.you.applicatio.withou.modifyin.cod.and—b.providin.set.o.alternativ.resources—enable.yo.t.optimiz.you.applicatio.fo..variet.o.devic.config uration.(nguage.an.scree.sizes).Fo.ever.resourc.tha.yo.includ.i.you.Androi.project.th.SD. .t.referenc.th .resourc.fro.you.applicatio.cod.o.fro.othe.resource.define.i .XML.Fo.example.i.you.applicatio.contain.a.imag. logo.png (save.i.the res/drawable/ directory).th.SD.tool.generat..r d .t.referenc.th. e.interface.On.o.th.mos.importan.aspect.o.providin.resource.separat.f ro.you.sourc.cod.i.th.abilit.fo.yo.t.provid.alternativ.resou rce.fo.differen.devic.configurations.Fo.example.b.definin.U. nguage.an.snguag.qualifie .tha.yo.appen.t.th.resourc.directory'.nam.(suc.as res/value s-fr/ er'.languag.setting.th. nguag.string.t.you.UI.Androi.support.man.different qualifiers fo.you.alternat iv.resources.Th.qualifie.i..shor.strin.tha.yo.includ.i.th.na m.o.you.resourc.directorie.i.orde.t.defin.th.devic.configura ed.A.anothe.example.yo.s yout.fo.you.activities.dependin.o .th.device'.scree.orientatio.an.size.Fo.example.whe.th.devic .scree.i.i.portrai.orientatio.(tall)you.wit. ndscap.orientatio. (wide)yo yout.a yout'.Th you.dependin .o.th.curren.devic.orientation.For more about the different kinds of resources you can include in your application and how to create alternative resources for various device configurations, see theApplication Resources developer guide.安卓应用基础在Java编程语言编写的Android应用程序的Android的SDK工具编译代码以及及任何数据和到一个Android的包, 一个归档文件档案资源的.apk后缀, 所有的在一个单一的代码.apk文件被认为是一个应用程序, 是Android的文件, 供电设备来安装应用程序。

安卓单词(国外英文资料)

安卓单词(国外英文资料)

安卓单词(国外英文资料)在当今数字化的时代,安卓操作系统已经成为全球范围内使用最广泛的移动操作系统之一。

安卓不仅为用户提供了丰富的应用和功能,还推动了移动技术的创新和发展。

然而,对于许多人来说,安卓系统中的许多专业术语和概念可能显得有些陌生和难以理解。

为了帮助用户更好地了解安卓系统,本文将介绍一些与安卓相关的常用单词和术语,并提供相关的英文资料,以便读者能够更深入地了解安卓系统的各个方面。

1. Android:安卓操作系统的名称,源自于英文单词“android”,意为“”。

2. APK:安卓应用程序的安装包文件格式,全称为“Android Package”。

3. Dalvik:安卓系统中的一个虚拟机,用于运行安卓应用程序。

4. ROM:安卓系统的固件版本,全称为“ReadOnly Memory”。

5. Root:对安卓系统进行解锁,以获得更高的权限和更广泛的控制。

6. SDK:安卓软件开发工具包,全称为“Software Development Kit”。

7. UI:用户界面,全称为“User Interface”。

8. UX:用户体验,全称为“User Experience”。

9. Widget:安卓系统中的一个小工具,可以显示在主屏幕上,提供快捷的操作和显示信息。

10. Fragment:安卓系统中的一个组件,用于实现用户界面的模块化。

1. Android Developers:安卓开发者官方网站,提供了丰富的文档、教程和资源,适合开发者学习安卓编程。

2. XDA Developers:一个安卓社区,提供了大量的安卓相关资讯、教程和讨论,适合对安卓系统感兴趣的用户。

3. Android Central:一个专注于安卓系统的新闻网站,提供了最新的安卓资讯、评测和教程。

4. Stack Overflow:一个编程问答社区,提供了大量的安卓编程问题解答,适合开发者解决安卓编程中的问题。

5. Reddit:一个社交新闻网站,有一个专门的安卓子版块,提供了大量的安卓相关讨论和分享。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Android Application Architectureauthor:Lars V ogel1、AndroidManifest.xmlThe components and settings of an Android application are described in the file AndroidManifest.xml. For example all Activities and Services of the application must be declared in this file.It must also contain the required permissions for the application. For example if the application requires network access it must be specified here.<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="/apk/res/android"package="de.vogella.android.temperature"android:versionCode="1"android:versionName="1.0"><application android:icon="@drawable/icon"android:label="@string/app_name"><activity android:name=".Convert"android:label="@string/app_name"><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="UNCHER" /></intent-filter></activity></application><uses-sdk android:minSdkVersion="9" /></manifest>The package attribute defines the base package for the Java objects referred to in this file. If a Java object lies within a different package, it must be declared with thefull qualified package name.Google Play requires that every Android application uses its own unique package. Therefore it is a good habit to use your reverse domain name as package name. This will avoid collisions with other Android applications.android:versionName and android:versionCode specify the version of your application. versionName is what the user sees and can be any String.versionCode must be an integer. The Android Market determine based on the versionCode, if it should perform an update of the applications for the existing installations. You typically start with "1" and increase this value by one, if you roll-out a new version of your application.The tag <activity> defines an Activity, in this example pointing to the Convert class in the de.vogella.android.temperature package. An intent filter is registered for this class which defines that this Activity is started once the application starts (action android:name="android.intent.action.MAIN"). The category definition category android:name="UNCHER" defines that this application is added to the application directory on the Android device.The @string/app_name value refers to resource files which contain the actual value of the application name. The usage of resource file makes it easy to provide different resources, e.g. strings, colors, icons, for different devices and makes it easy to translate applications.The "uses-sdk" part of the "AndroidManifest.xml" file defines the minimal SDK version for which your application is valid. This will prevent your application being installed on devices with older SDK versions.2、R.java and ResourcesThe " gen " directory in an Android project contains generated values. R.java is a generated class which contains references to certain resources of the project.These resources must be defined in the "res" directory and can be XML files, icons or pictures. You can for example define values, menus, layouts or animations via XML files.If you create a new resource, the corresponding reference is automatically created in R.java via the Eclipse ADT tools. These references are static int values and defineID's for the resources.The Android system provides methods to access the corresponding resource via these ID's.For example to access a String with the R.string.yourString ID, you would use the getString(R.string.yourString)) method.R.java is automatically created by the Eclipse development environment, manual changes are not necessary and will be overridden by the tooling.3、AssetsWhile the res directory contains structured values which are known to the Android platform, the assets directory can be used to store any kind of data. You access this data via the AssetsManager which you can access the getAssets() method.AssetsManager allows to read an assets as InputStream with the open() method.// Get the AssetManagerAssetManager manager = getAssets();// Read a Bitmap from Assetstry {InputStream open = manager.open("logo.png");Bitmap bitmap = BitmapFactory.decodeStream(open);// Assign the bitmap to an ImageView in this layoutImageView view = (ImageView) findViewById(R.id.imageView1);view.setImageBitmap(bitmap);} catch (IOException e) {e.printStackTrace();}4、Activities and LayoutsThe user interface for Activities is defined via layouts. The layout defines the included Views (widgets) and their properties.A layout can be defined via Java code or via XML. In most cases the layout is defined as an XML file.XML based layouts are defined via a resource file in the /res/layout folder. This file specifies the ViewGroups, Views, their relationship and their attributes forthis specific layout.If a View needs to be accessed via Java code, you have to give the View a unique ID via the android:id attribute. To assign a new ID to a View use @+id/yourvalue. The following shows an example in which a Button gets the "button1" ID assigned.<Buttonandroid:id="@+id/button1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Show Preferences" ></Button>By conversion this will create and assign a new yourvalue ID to the corresponding View. In your Java code you can later access a View via the method findViewById(R.id.yourvalue).Defining layouts via XML is usually the preferred way as this separates the programming logic from the layout definition. It also allows the definition of different layouts for different devices. You can also mix both approaches.5、Reference to resources in XML filesIn your XML files, for example your layout files, you can refer to other resources via the @ sign.For example, if you want to refer to a color which is defined in a XML resource, you can refer to it via @color/your_id. Or if you defined a "hello" string in an XML resource, you could access it via @string/hello.6、Activities and LifecycleThe Android system controls the lifecycle of your application. At any time the Android system may stop or destroy your application, e.g. because of an incoming call. The Android system defines a lifecycle for Activities via predefined methods. The most important methods are:onSaveInstanceState() - called if the Activity is stopped. Used to save data so that the Activity can restore its states if re-startedonPause() - always called if the Activity ends, can be used to release resource orsave dataonResume() - called if the Activity is re-started, can be used to initialize fields7、Configuration ChangeAn Activity will also be restarted, if a so called "configuration change" happens.A configuration change happens if an event is triggered which may be relevant for the application. For example if the user changes the orientation of the device (vertically or horizontally). Android assumes that an Activity might want to use different resources for these orientations and restarts the Activity.In the emulator you can simulate the change of the orientation via CNTR+F11.You can avoid a restart of your application for certain configuration changes via the configChanges attribute on your Activity definition in your AndroidManifest.xml. The following Activity will not be restarted in case of orientation changes or position of the physical keyboard (hidden / visible).<activity android:name=".ProgressTestActivity"android:label="@string/app_name"android:configChanges="orientation|keyboardHidden|keyboard"> </activity>8、ContextThe class android.content.Context provides the connections to the Android system. It is the interface to global information about the application environment. Context also provides access to Android Services, e.g. the Location Service. Activities and Services extend the Context class and can therefore be used as Context.Android应用架构作者:Lars Vogel(拉尔斯·沃格尔)1、AndroidManifest.xml一个Android应用程序的组件和设置描述文件中的AndroidManifest.xml。

相关文档
最新文档