基于Android开发的外文文献

合集下载

关于Android的外文文献

关于Android的外文文献

附件A 外文文献(英文)Android: A Programmer’s Guide1 What Is Android1.1 Key Skills & Concepts●History of embedded device programming●Explanation of Open Handset Alliance●First look at the Android home screenIt can be said that, for a while, traditional desktop application developers have been spoiled. This is not to say that traditional desktop application development is easier than other forms of development. However, as traditional desktop application developers, we have had the ability to create almost any kind of application we can imagine. I am including myself in this grouping because I got my start in desktop programming.One aspect that has made desktop programming more accessible is that we have had the ability to interact with the desktop operating system, and thus interact with any underlying hardware, pretty freely (or at least with minimal exceptions). This kind of freedom to program independently, however, has never really been available to the small group of programmers who dared to venture into the murky waters of cell phone development.NOTE :I refer to two different kinds of developers in this discussion: traditional desktop application developers, who work in almost any language and whose end product, applications, are built to run on any “desktop” operating system; and Android developers, Ja va developers who develop for the Android platform. This is not for the purposes of saying one is by any means better or worse than the other. Rather, the distinction is made for purposes of comparing the development styles and tools of desktop operating system environments to the mobile operating system environment,1.2 Brief History of Embedded Device ProgrammingFor a long time, cell phone developers comprised a small sect of a slightly larger group of developers known as embedded device developers. Seen as a less “glamorous” sibling to desktop—and later web—development, embedded device development typically got the proverbial short end of the stick as far as hardware and operating system features, because embedded device manufacturers were notoriously stingy on feature support.Embedded device manufacturers typically needed to guard their hardware secrets closely, so they gave embedded device developers few libraries to call when trying to interact with a specific device. Embedded devices differ from desktops in that an embedded device is typically a “computer on a chip.” For example, consider your standard television remote control; it is not really seen as an overwhelming achievement of technological complexity. When any button is pressed, a chip interprets the signal in a way that has been programmed into the device. This allows the device to know what to expect from the input device (key pad), and how to respond to those commands (for example, turn on the television). This is a simple form of embedded device programming. However, believe it or not, simple devices such as these are definitely related to the roots of early cell phone devices and development.Most embedded devices ran (and in some cases still run) proprietary operating systems. The reason for choosing to create a proprietary operating system rather than use any consumer system was really a product of necessity. Simple devices did not need very robust and optimized operating systems.As a product of device evolution, many of the more complex embedded devices, such as early PDAs, household security systems, and GPSs, moved to somewhat standardized operating system platforms about five years ago. Small-footprint operating systems such as Linux, or even an embedded version of Microsoft Windows, have become more prevalent on many embedded devices. Around this time in device evolution, cell phones branched from other embedded devices onto their own path. This branching is evident when you examine their architecture.Nearly since their inception, cell phones have been fringe devices insofar as they run on proprietary software—software that is owned and controlled by the manufacturer, and is almostalways considered to be a “closed” system. The practice of manufacturers using proprietar y operating systems began more out of necessity than any other reason. That is, cell phone manufacturers typically used hardware that was completely developed in-house, or at least hardware that was specifically developed for the purposes of running cell phone equipment. As a result, there were no openly available, off-the-shelf software packages or solutions that would reliably interact with their hardware. Since the manufacturers also wanted to guard very closely their hardware trade secrets, some of which could be revealed by allowing access to the software level of the device, the common practice was, and in most cases still is, to use completely proprietary and closed software to run their devices. The downside to this is that anyone who wanted to develop applications for cell phones needed to have intimate knowledge of the proprietary environment within which it was to run. The solution was to purchase expensive development tools directly from the manufacturer. This isolated many of the “homebrew” devel opers.NOTE:A growing culture of homebrew developers has embraced cell phone application development. The term “homebrew” refers to the fact that these developers typically do not work for a cell phone development company and generally produce small, one-off products on their own time.Another, more compelling “necessity” that kept cell phone development out of the hands of the everyday developer was the hardware manufacturers’ solution to the “memory versus need” dilemma. Until recently, cell phon es did little more than execute and receive phone calls, track your contacts, and possibly send and receive short text messages; not really the “Swiss army knives” of technology they are today. Even as late as 2002, cell phones with cameras were not commonly found in the hands of consumers.By 1997, small applications such as calculators and games (Tetris, for example) crept their way onto cell phones, but the overwhelming function was still that of a phone dialer itself. Cell phones had not yet become the multiuse, multifunction personal tools they are today. No one yet saw the need for Internet browsing, MP3 playing, or any of the multitudes of functions we are accustomed to using today. It is possible that the cell phone manufacturers of 1997 did not fully perceive the need consumers would have for an all-in-one device. However, even if the need was present, a lack of device memory and storage capacity was an even biggerobstacle to overcome. More people may have wanted their devices to be all-in-one tools, but manufacturers still had to climb the memory hurdle.To put the problem simply, it takes memory to store and run applications on any device, cell phones included. Cell phones, as a device, until recently did not have the amount of memory avail able to them that would facilitate the inclusion of “extra” programs. Within the last two years, the price of memory has reached very low levels. Device manufacturers now have the ability to include more memory at lower prices. Many cell phones now have more standard memory than the average PC had in the mid-1990s. So, now that we have the need, and the memory, we can all jump in and develop cool applications for cell phones around the world, right? Not exactly.Device manufacturers still closely guard the operating systems that run on their devices. While a few have opened up to the point where they will allow some Java-based applications to run within a small environment on the phone, many do not allow this. Even the systems that do allow some Java apps to run do not allow the kind of access to the “core” system that standard desktop developers are accustomed to having.1.3 Open Handset Alliance and AndroidThis barrier to application development began to crumble in November of 2007 when Google, under the Open Handset Alliance, released Android. The Open Handset Alliance is a group of hardware and software developers, including Google, NTT DoCoMo, Sprint Nextel, and HTC, whose goal is to create a more open cell phone environment. The first product to be released under the alliance is the mobile device operating system, Android. (For more information about the Open Handset Alliance, see .)NOTE :Google, in promoting the new Android operating system, even went as far as to create a $10 million contest looking for new and exciting Android applications.While cell phones running Linux, Windows, and even PalmOS are easy to find, as of this writing, no hardware platforms have been announced for Android to run on. HTC, LG Electronics, Motorola, and Samsung are members of the Open Handset Alliance, under which Android has been released, so we can only hope that they have plans for a few Android-based devices in the near future. With its release in November 2007, the system itself is still in asoftware-only beta. This is good news for developers because it gives us a rare advance look at a future system and a chance to begin developing applications that will run as soon as the hardware is released.NOTE:This strategy clearly gives the Open Handset Alliance a big advantage over other cell phone operating system developers, because there could be an uncountable number of applications available immediately for the first devices released to run Android.Introduction to AndroidAndroid, as a system, is a Java-based operating system that runs on the Linux 2.6 kernel. The system is very lightweight and full featured. Android applications are developed using Java and can be ported rather easily to the new platform. If you have not yet downloaded Java or are unsure about which version you need, I detail the installation of the development environment in Chapter 2. Other features of Android include an accelerated 3-D graphics engine (based on hardware support), database support powered by SQLite, and an integrated web browser.If you are familiar with Java programming or are an OOP developer of any sort, you are likely used to programmatic user interface (UI) development—that is, UI placement which is handled directly within the program code. Android, while recognizing and allowing for programmatic UI development, also supports the newer, XML-based UI layout. XML UI layout is a fairly new concept to the average desktop developer. I will cover both the XML UI layout and the programmatic UI development in the supporting chapters of this book.One of the more exciting and compelling features of Android is that, because of its architecture, third-party applications—includi ng those that are “home grown”—are executed with the same system priority as those that are bundled with the core system. This is a major departure from most systems, which give embedded system apps a greater execution priority than the thread priority available to apps created by third-party developers. Also, each application is executed within its own thread using a very lightweight virtual machine.Aside from the very generous SDK and the well-formed libraries that are available to us to develop with, the most exciting feature for Android developers is that we now have access to anything the operating system has access to. In other words, if you want to create an application that dials the phone, you have access to the phone’s dialer; if you want to creat e anapplication that utilizes the phone’s internal GPS (if equipped), you have access to it. The potential for developers to create dynamic and intriguing applications is now wide open.On top of all the features that are available from the Android side of the equation, Google has thrown in some very tantalizing features of its own. Developers of Android applications will be able to tie their applications into existing Google offerings such as Google Maps and the omnipresent Google Search. Suppose you want to write an application that pulls up a Google map of where an incoming call is emanating from, or you want to be able to store common search results with your contacts; the doors of possibility have been flung wide open with Android.Chapter 2 begins your journey to Android development. You will learn the how’s and why’s of using specific development environments or integrated development environments (IDE), and you will download and install the Java IDE Eclipse.2 Application: Hello World2.1 Key Skills & Concepts●Creating new Android projects●Working with Views●Using a TextView●Modifying the main.xml file●Running applications on the Android EmulatorIn this chapter, you will be creating your first Android Activity. This chapter examines the application-building process from start to finish. I will show you how to create an Android project in Eclipse, add code to the initial files, and run the finished application in the Android Emulator. The resulting application will be a fully functioning program running in an Android environment.Actually, as you move through this chapter, you will be creating more than one Android Activity. Computer programming tradition dictates that your first application be the typical Hello World! application, so in the first section you will create a standard Hello World!application with just a blank background and the “Hello World!” text. Then, for the sake of enabling you to get to know the language better, the next section explains in detail the files automatically created by Android for your Hello World! application. You will create two iterations of this Activity, each using different techniques for displaying information to the screen. You will also create two different versions of a Hello World! application that will display an image that delivers the “Hello World!” message. This will give you a good introduction to the controls and inner workings of Android.NOTE:You will often see “application” and “Activity” used interchangeably. The difference between the two is that an application can be composed of multiple Activities, but one application must have at least one Activity. Each “window” or screen of your application is a separate Activity. Therefore, if you create a fairly simple application with only one screen of data (like the Hello World! application in this chapter), that will be one Activity. In future chapters you will create applications with multiple Activities.To make sure that you get a good overall look at programming in Android, in Chapter 6 you will create both of these applications in the Android SDK command-line environment for Microsoft Windows and Linux. In other words, this chapter covers the creation process in Eclipse, and Chapter 6 covers the creation process using the command-line tools. Therefore, before continuing, you should check that your Eclipse environment is correctly configured. Review the steps in Chapter 3 for setting the PATH statement for the Android SDK. You should also ensure that the JRE is correctly in your PATH statement.TIP:If you have configuration-related issues while attempting to work with any of the command-line examples, try referring to the configuration steps in Chapters 2 and 3; and look at the Android SDK documentation.2.2 Creating Your First Android Project in EclipseTo start your first Android project, open Eclipse. When you open Eclipse for the first time, it opens to an empty development environment (see Figure 5-1), which is where you want to begin. Your first task is to set up and name the workspace for your application. Choose File | New | Android Project, which will launch the New Android Project wizard.CAUTION Do not select Java Project from the New menu. While Android applications are written in Java, and you are doing all of your development in Java projects, this option will create a standard Java application. Selecting Android Project enables you to create Android-specific applications.If you do not see the option for Android Project, this indicates that the Android plugin for Eclipse was not fully or correctly installed. Review the procedure in Chapter 3 for installing the Android plugin for Eclipse to correct this.2.3 The New Android Project wizard creates two things for youA shell application that ties into the Android SDK, using the android.jar file, and ties the project into the Android Emulator. This allows you to code using all of the Android libraries and packages, and also lets you debug your applications in the proper environment.Your first shell files for the new project. These shell files contain some of the vital application blocks upon which you will be building your programs. In much the same way as creating a Microsoft .NET application in Visual Studio generates some Windows-created program code in your files, using the Android Project wizard in Eclipse generates your initial program files and some Android-created code. In addition, the New Android Project wizard contains a few options, shown next, that you must set to initiate your Android project. For the Project Name field, for purposes of this example, use the title HelloWorldText. This name sufficiently distinguishes this Hello World! project from the others that you will be creating in this chapter.In the Contents area, keep the default selections: the Create New Project in Workspace radio button should be selected and the Use Default Location check box should be checked. This will allow Eclipse to create your project in your default workspace directory. The advantage of keeping the default options is that your projects are kept in a central location, which makes ordering, managing, and finding these projects quite easy. For example, if you are working in a Unix-based environment, this path points to your $HOME directory.If you are working in a Microsoft Windows environment, the workspace path will be C:/Users/<username>/workspace, as shown in the previous illustration. However, for any number of reasons, you may want to uncheck the Use Default Location check box and select a different location for your project. One reason you may want to specify a different location here is simply if you want to choose a location for this specific project that is separate fromother Android projects. For example, you may want to keep the projects that you create in this book in a different location from projects that you create in the future on your own. If so, simply override the Location option to specify your own custom location directory for this project.附件B外文文献(中文)Android:一个程序员的入门书1 什么是Android1.1 主要技巧和思想●历史的嵌入式器件编程●开放手机联盟的解释●第一眼看到Android的主屏幕可以这么说,暂时,传统的桌面应用程序开发者已经被惯坏了。

外文文献-The basic of description of android system对Android系统的基本描诉

外文文献-The basic of description of android system对Android系统的基本描诉

外文文献-The basic of description of android system对Android系统的基本描诉毕业设计外文文献原文及译文The basic of description of android system对Android系统的基本描诉学生姓名: 学号:电子与计算机科学技术系系别:计算机科学与技术专业:指导教师:2015年 5 月2015届毕业设计外文文献原文及译文The basic of description of android systemBy 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 2008 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 2008. According to industry insiders expect the G1 mobile phone sales in 2009 continue.Many other mobile phone suppliers in the near future plans to supportthis system.Around an android and a huge developer community has been established, 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. 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 embeddedLinux 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 applicationto call each other API .Although these applications have certain safety features, some ofour experienced developers to create Android applications who revealed that the design of security2015届毕业设计外文文献原文及译文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 SDK .The 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 take such action specially designed services. Developers can also use a special daemon at system start up, 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.Content Provider 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 (for example 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.2015届毕业设计外文文献原文及译文Therefore, the radio receiver subscribe to these destinationsreceive 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 initiate an activity.such as start an activity (startActivity (An intent)) start services (the start Service (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.Android applications are written in the Java programminglanguage.The compiled Java code — along with any data and resource files required by the application — is bundled bythe apt tool into an Android package,an archive file marked by an .A 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 Linuxprocess.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.2015届毕业设计外文文献原文及译文(3) By default,each application is assigned a unique Linux userID.Permissions are set so that the application's files are visible only to that user and only to the application itself there are ways to export them to other applications as well.Application ComponentsA central feature of Android is that one application can make use of elements 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 and made it available to others,you can call upon that 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 isneeded,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(nomain()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 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.Moving2015届毕业设计外文文献原文及译文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 andfloat on top of other windows.An activity can also make use ofadditional windows — for example,a pop-up dialog that calls for a user response in the midst of the activity,or a window that presentsusers 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 thatimage.Android has a number of ready-made views that you can use —including buttons,text fields,scroll bars,menu items,check boxes,and more.ServicesA service doesn't have a visual user interface,but rather runs inthe 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 theuser 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 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 startthe service if it's not2015届毕业设计外文文献原文及译文already running).While connected,you can communicate with theservice through an interface that the service exposes.For the music service,this interface might allow users to pause,rewind,stop,andrestart 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 fortime-consuming tasks(like music playback).See Processes and Thread,later.Broadcast receiversA broadcast receiver is a component that does nothing but receiveand react to broadcast announcements.Many broadcasts originate in system code — for example,announcements thatthe 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 letother 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 Broadcast Receiver 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 Notification Manager to alert the user.Notifications can get the user's attention in various ways — flashing the back light,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 database,or in any other manner that makes sense.The content provider extends the Content Provider base class to implement a standard set of methods that enable other applications to retrieve and store data of the type it2015届毕业设计外文文献原文及译文controls.However,applications do not call these methodsdirectly.Rather they use a Content Resolver object and call its methods instead.A Content Resolver can talk to any content provider;it cooperates with the provider to manage any inter process 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.2015届毕业设计外文文献原文及译文The basic of description of android system对Android系统的基本描诉由开放手机联盟(Open Handset Alliance LED通过谷歌)开发的安卓系统是一个开源的手机系统被广泛看好,该系统提供了一个基本的操作系统,中间件的应用层,一个Java开发工具和应用系统集热器(系统应用收集)。

基于Android开发的外文文献

基于Android开发的外文文献

AndroidAndroid, as a system, is a Java-based operating system that runs on the Linux 2、6 kernel、The system is very lightweight and full featured、Android applications are developed using Java and can be ported rather easily to the new platform、If you have not yet downloaded Java or are unsure about which version you need, I detail the installation of the development environment in Chapter 2、Other features of Android include an accelerated 3-D graphics engine (based on hardware support), database support powered by SQLite, and an integrated web browser、If you are familiar with Java programming or are an OOP developer of any sort, you are likely used to programmatic user interface (UI) development—that is, UI placement which is handled directly within the program code、Android, while recognizing and allowing for programmatic UI development, also supports the newer, XML-based UI layout、XML UI layout is a fairly new concept to the average desktop developer、I will cover both the XML UI layout and the programmatic UI development in the supporting chapters of this book、One of the more exciting and compelling features of Android is that, because of its architecture, third-party applications—including those that are “home grown”—are executed with the same system priority as those that are bundled with the core system、This is a major departure from most systems, which give embedded system apps a greater execution priority than the thread priority available to apps created by third-party developers、Also, each application is executed within its own thread using a very lightweight virtual machine、Aside from the very generous SDK and the well-formed libraries that are available to us to develop with, the most exciting feature for Android developers is that we now have access to anything the operating system has access to、In other words, if you want to create an application that dials the phone, you have access to the phone’s dialer; if you want to create an application that utilizes the phone’s internalGPS (if equipped), you have access to it、The potential for developers to create dynamic and intriguing applications is now wide open、On top of all the features that are available from the Android side of the equation, Google has thrown in some very tantalizing features of its own、Developers of Android applications will be able to tie their applications into existing Google offerings such as Google Maps and the omnipresent Google Search、Suppose you want to write an application that pulls up a Google map of where an incoming call is emanating from, or you want to be able to store common search results with your contacts; the doors of possibility have been flung wide open with Android、Chapter 2 begins your journey to Android development、You will learn the how’s and why’s of using specific development environments or integrated development environments (IDE), and you will download and install the Java IDE Eclipse、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 theuser 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)、SeeProcesses 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 , 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 usingcontent 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、Key Skills & Concepts●Creating new Android projects●Working with Views●Using a TextView●Modifying the main、xml fileCreating Your First Android Project in EclipseTo start your first Android project, open Eclipse、When you open Eclipse for the first time, it opens to an empty development environment (see Figure 5-1), which is where you want to begin、Your first task is to set up and name the workspace for your application、Choose File | New | Android Project, which will launch the New Android Project wizard、CAUTION Do not select Java Project from the New menu、While Android applications are written in Java, and you are doing all of your development in Java projects, this option will create a standard Java application、Selecting Android Project enables you to create Android-specific applications、If you do not see the option for Android Project, this indicates that the Android plugin for Eclipse was not fully or correctly installed、Review the procedure in Chapter 3 for installing the Android plugin for Eclipse to correct this、The New Android Project wizard creates two things for youA shell application that ties into the Android SDK, using the android、jar file, andties the project into the Android Emulator、This allows you to code using all of the Android libraries and packages, and also lets you debug your applications in the proper environment、Your first shell files for the new project、These shell files contain some of the vital application blocks upon which you will be building your programs、In much the same way as creating a Microsoft 、NET application in Visual Studio generates some Windows-created program code in your files, using the Android Project wizard in Eclipse generates your initial program files and some Android-created code、In addition, the New Android Project wizard contains a few options, shown next, that you must set to initiate your Android project、For the Project Name field, for purposes of this example, use the title HelloWorldText、This name sufficiently distinguishes this Hello World! project from the others that you will be creating in this chapter、In the Contents area, keep the default selections: the Create New Project in Workspace radio button should be selected and the Use Default Location check box should be checked、This will allow Eclipse to create your project in your default workspace directory、The advantage of keeping the default options is that your projects are kept in a central location, which makes ordering, managing, and finding these projects quite easy、For example, if you are working in a Unix-based environment, this path points to your $HOME directory、If you are working in a Microsoft Windows environment, the workspace path will be C:/Users/<username>/workspace, as shown in the previous illustration、However, for any number of reasons, you may want to uncheck the Use Default Location check box and select a different location for your project、One reason you may want to specify a different location here is simply if you want to choose a location for this specific project that is separate from other Android projects、For example, you may want to keep the projects that you create in this book in a different location from projects that you create in the future on your own、If so, simply override the Location option to specify your own custom location directory for this project、。

软件工程专业Android-Application-Fundamentals安卓应用基础大学毕业论文外文文献翻译及原文

软件工程专业Android-Application-Fundamentals安卓应用基础大学毕业论文外文文献翻译及原文

毕业设计(论文)外文文献翻译文献、资料中文题目:安卓应用基础文献、资料英文题目:Android Application Fundamentals 文献、资料来源:文献、资料发表(出版)日期:院(部):专业:软件工程专业班级:姓名:学号:指导教师:翻译日期: 2017.02.14毕业设计(论文)外文翻译题目Android Application Fundamentals专业网络工程班级网络学生指导教师Android Application Fundamentals Android 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 a different user.·By default, the system assigns each application a unique Linux user ID (the ID is used only by the system and is unknown to the application). The system sets permissions for all the files 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 isolation from other applications.·By default, every application runs in its own Linux process. Android starts the process when any of the application's components need to be executed, then shuts down the process when it's no longer needed or when the system must recover memory for other applications.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 otherapplications 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 case they are able to access each other's files. To conserve system resources, applications with the same user ID can also arrange to run in the same Linux process and share the same VM (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. All application 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 your application.·Resources that are separate from the application code and allow your application to gracefully 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 email application 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 in the Activities developer guide.ServicesA service is a component that runs in the background to perform long-running operations or to 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 moreabout it in the Services developer guide.Content providersA content provider manages a shared set of application data. You can store the data in the file 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 provides a content provider that manages the user's contact information. As such, any application with the 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 a standard set of APIs that enable other applications to perform transactions. For more information, see the Content Providers developer guide.Broadcast receiversA broadcast receiver is a component that responds to system-wide broadcast announcements. 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 auser 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 each broadcast is delivered as an Intent object. For more information, see theBroadcastReceiver 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's no 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 cannotdirectly 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. The 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:·You can start an activity (or give it something new to do) by passing an Intent to startActivity() or startActivityForResult() (when you want the activity to return a result).·You 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 passing 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 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 following documents: Activities, Services, BroadcastReceiver and Content Providers.Declaring componentsThe primary task of the manifest is to inform the system about the。

Android外文文献翻译

Android外文文献翻译

An droid Applicati on Fun dame ntalsAn droid applicatio ns are writte n in the Java program ming Ian guage. The An droid SDK tools compile the code— along with any data and resource file—into an An droid package, an archive file with an .apk suffix. All the code in a single .apk file is considered to be one applicatio n and is the file that An droid-powered devices use to in stall the applicatio n.Once in stalled on a device, each An droid applicati on lives in its own security san dbox:The An droid operati ng system is a multi-user Linux system in which each applicatio n is a differe nt user.By default, the system assigns each application a unique Linux user ID (the ID is used only by the system and is unknown to the application). The system sets permissions for all the files 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 isolation from other applicati ons.By default, every applicatio n runs in its own Linux process. An droid starts the process whe n any of the applicati on's comp onents n eed to be executed, the n shuts dow n the process whe n it's no Ion ger n eeded or whe n the system must recover memory for other applicati ons. In this way, the An droid system impleme nts thepri nciple 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 en vir onment in which an applicati on cannot access parts of the system for which it is not give n permissi on.However, there are ways for an applicati on to share data with other applicati ons and for an applicati on to access system services:It's possible to arrange for two applicati ons to share the same Linux user ID, in which case they are able to access each other's files. To con serve system resources, applicati ons with the same user ID can also arrange to run in the same Linux process and share the same VM (the applications must also be signed with the same certificate).An applicatio n can request permissi on to access device data such as the user's con tacts, SMS messages, the mountable storage (SD card), camera, Bluetooth, and more. All applicatio n permissi ons must be gran ted by the user at in stall time.That covers the basics regardi ng how an An droid applicati on exists withi n the system. The rest of this docume nt in troduces you to:1、The core framework components that define your application.2、The manifest file in which you declare components and required device features for your applicati on.3、Resources that are separate from the application code and allow your application to gracefully optimize its behavior for a variety of device con figurati ons.Applicati on Comp onentsApplicatio n comp onents are the esse ntial build ing blocks of an An droid applicati on. Each comp onent is a differe nt point through which the system can en ter your applicati on. Not all comp onents are actual entry points for the user and some depe nd on each other, but each one exists as its own entity and plays a specific ro—each one is a unique building block that helps define your application's overall behavior.There are four differe nt types of applicati on comp onen ts. Each type serves a disti net purpose and has a distinct lifecycle that defines how the component is created and destroyed.Here are the four types of applicati on comp onen ts:ActivitiesAn activity represe nts a sin gle scree n with a user in terface. 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 experie nee in the email applicati on, each one is in depe ndent 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 email applicati on that composes new mail, in order for the user to share a picture.An activity is implemented as a subclass oActivity and you can leann more about it in the Activities developer guide.ServicesA serviceis a comp onent that runs in the backgro und to perform long-running operatio nsor to perform work for remote processes.A service does not provide a user in terface. Forexample, 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 in teract with it.A service is implemented as a subclass of Service and you can learn more about it in the Services developer guide.Content providersA content provider man ages a shared set of applicati on data. You can store the data in the file 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 An droid system provides a content provider that man ages the user's con tact in formati on. As such, any applicati on with the proper permissi ons can query part of the content provider (such a Con tactsC on tract.Data) to read and write in formati on about a particular pers on.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 no tes.A content provider is implemented as a subclass o ContentProvider and must implement a standard set of APIs that enable other applications to perform transactions. For more in formati on, see the Co ntent Providers developer guide.Broadcast receiversA broadcast receiver is a component that responds to system-wide broadcast announ ceme nts. Many broadcasts orig in ate 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 in terface, they may reate a status bar notificati on to alert the user whe n a broadcast eve nt occurs. More com monly, though, a broadcast receiver is just a "gateway" to other comp onents and is inten ded to do a very mini mal amount of work. For in sta nee, it might in itiate a service to perform some work based on the eve nt.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 itin order to interact with it.A service is implemented as a subclass of Service and you can learn more about it in the Services developer guide.Content providersA content provider manages a shared set of application data. You can store the data in the file 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 provides a content provider that manages the user's contact information. As such, any application with the proper permissions can query part of the content provider (such a C s ontactsContract.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 a standard set of APIs that enable other applications to perform transactions. For more information, see the Content Providers developer guide.Broadcast receiversA broadcast receiver is a component that responds to system-wide broadcast announcements. 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.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 itin order to interact with it.A service is implemented as a subclass of Service and you can learn more about it in the Services developer guide.Content providersA content provider manages a shared set of application data. You can store the data in the file 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 provides a content provider that manages the user's contact information. As such, any application with the proper permissions can query part of the content provider (such a C s ontactsContract.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 a standard set of APIs that enable other applications to perform transactions. For more information, see the Content Providers developer guide.Broadcast receiversA broadcast receiver is a component that responds to system-wide broadcast announcements. 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.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 itin order to interact with it.A service is implemented as a subclass of Service and you can learn more about it in the Services developer guide.Content providersA content provider manages a shared set of application data. You can store the data in the file 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 provides a content provider that manages the user's contact information. As such, any application with the proper permissions can query part of the content provider (such a C s ontactsContract.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 a standard set of APIs that enable other applications to perform transactions. For more information, see the Content Providers developer guide.Broadcast receiversA broadcast receiver is a component that responds to system-wide broadcast announcements. 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.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 itin order to interact with it.A service is implemented as a subclass of Service and you can learn more about it in the Services developer guide.Content providersA content provider manages a shared set of application data. You can store the data in the file 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 provides a content provider that manages the user's contact information. As such, any application with the proper permissions can query part of the content provider (such a C s ontactsContract.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 a standard set of APIs that enable other applications to perform transactions. For more information, see the Content Providers developer guide.Broadcast receiversA broadcast receiver is a component that responds to system-wide broadcast announcements. 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.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 itin order to interact with it.A service is implemented as a subclass of Service and you can learn more about it in the Services developer guide.Content providersA content provider manages a shared set of application data. You can store the data in the file 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 provides a content provider that manages the user's contact information. As such, any application with the proper permissions can query part of the content provider (such a C s ontactsContract.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 a standard set of APIs that enable other applications to perform transactions. For more information, see the Content Providers developer guide.Broadcast receiversA broadcast receiver is a component that responds to system-wide broadcast announcements. 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.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 itin order to interact with it.A service is implemented as a subclass of Service and you can learn more about it in the Services developer guide.Content providersA content provider manages a shared set of application data. You can store the data in the file 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 provides a content provider that manages the user's contact information. As such, any application with the proper permissions can query part of the content provider (such a C s ontactsContract.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 a standard set of APIs that enable other applications to perform transactions. For more information, see the Content Providers developer guide.Broadcast receiversA broadcast receiver is a component that responds to system-wide broadcast announcements. 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.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 itin order to interact with it.A service is implemented as a subclass of Service and you can learn more about it in the Services developer guide.Content providersA content provider manages a shared set of application data. You can store the data in the file 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 provides a content provider that manages the user's contact information. As such, any application with the proper permissions can query part of the content provider (such a C s ontactsContract.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 a standard set of APIs that enable other applications to perform transactions. For more information, see the Content Providers developer guide.Broadcast receiversA broadcast receiver is a component that responds to system-wide broadcast announcements. 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.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 itin order to interact with it.A service is implemented as a subclass of Service and you can learn more about it in the Services developer guide.Content providersA content provider manages a shared set of application data. You can store the data in the file 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 provides a content provider that manages the user's contact information. As such, any application with the proper permissions can query part of the content provider (such a C s ontactsContract.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 a standard set of APIs that enable other applications to perform transactions. For more information, see the Content Providers developer guide.Broadcast receiversA broadcast receiver is a component that responds to system-wide broadcast announcements. 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.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 itin order to interact with it.A service is implemented as a subclass of Service and you can learn more about it in the Services developer guide.Content providersA content provider manages a shared set of application data. You can store the data in the file 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 provides a content provider that manages the user's contact information. As such, any application with the proper permissions can query part of the content provider (such a C s ontactsContract.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 a standard set of APIs that enable other applications to perform transactions. For more information, see the Content Providers developer guide.Broadcast receiversA broadcast receiver is a component that responds to system-wide broadcast announcements. 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.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 itin order to interact with it.A service is implemented as a subclass of Service and you can learn more about it in the Services developer guide.Content providersA content provider manages a shared set of application data. You can store the data in the file 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 provides a content provider that manages the user's contact information. As such, any application with the proper permissions can query part of the content provider (such a C s ontactsContract.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 a standard set of APIs that enable other applications to perform transactions. For more information, see the Content Providers developer guide.Broadcast receiversA broadcast receiver is a component that responds to system-wide broadcast announcements. 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.。

通信工程专业基于Android应用的无处不在的智能家居系统毕业论文外文文献翻译及原文

通信工程专业基于Android应用的无处不在的智能家居系统毕业论文外文文献翻译及原文

毕业设计(论文)外文文献翻译文献、资料中文题目:基于Android应用的无处不在的智能家居系统文献、资料英文题目:文献、资料来源:文献、资料发表(出版)日期:院(部):专业:通信工程班级:姓名:学号:指导教师:翻译日期: 2017.02.14毕业设计外文翻译毕业设计题目基于ANDRIO的智能家居系统的设计与实现外文题目UBIQUITOUS SMART HOME SYSTEM USING ANDROID APPLICATIONInternational Journal of Computer Networks & Communications (IJCNC) V ol.6, No.1, January 2014基于Android应用的无处不在的智能家居系统Shiu KumarDepartment of Information Electronics Engineering, Mokpo National University,534-729, Mokpo, South Korea摘要本文提出了一种灵活独立的,低成本的智能家居系统,它是基于Android应用与微web服务器通信,不仅仅提供交换功能。

Arduino以太网的使用是为了避免使用个人电脑从而保证整个系统成本最低,语音激活时用来实现切换功能的。

光开关,电源插头,温度传感器,湿度传感器,电流传感器,入侵检测传感器,烟雾/气体传感器和警报器等这些设备集成在系统中,表明了所提出的智能家居系统的有效性和可行性。

经过检测,智能家居应用程序可以成功地进行智能家居操作,例如开关功能,自动环境监测,和入侵监测,在监测到有不法入侵后,系统会自动发送一个邮件,并响警笛。

关键字:Android智能手机,智能家居,物联网(loTs),远程控制1.引言随着移动设备受欢迎程度的不断增长和人们日常生活中对无处不在的先进的移动应用的功能需求不断增加,利用Web服务是提供远程访问服务的最开放和可互操作的方式,并且使应用程序能够彼此通信。

(完整版)基于Android开发的外文文献

(完整版)基于Android开发的外文文献

AndroidAndroid, as a system, is a Java-based operating system that runs on the Linux 2.6 kernel. The system is very lightweight and full featured. Android applications are developed using Java and can be ported rather easily to the new platform. If you have not yet downloaded Java or are unsure about which version you need, I detail the installation of the development environment in Chapter 2. Other features of Android include an accelerated 3-D graphics engine (based on hardware support), database support powered by SQLite, and an integrated web browser.If you are familiar with Java programming or are an OOP developer of any sort, you are likely used to programmatic user interface (UI) development—that is, UI placement which is handled directly within the program code. Android, while recognizing and allowing for programmatic UI development, also supports the newer, XML-based UI layout. XML UI layout is a fairly new concept to the average desktop developer. I will cover both the XML UI layout and the programmatic UI development in the supporting chapters of this book.One of the more exciting and compelling features of Android is that, because of its architecture, third-party applications—including those that are “home grown”—are executed with the same system priority as those that are bundled with the core system. This is a major departure from most systems, which give embedded system apps a greater execution priority than the thread priority available to apps created by third-party developers. Also, each application is executed within its own thread using a very lightweight virtual machine.Aside from the very generous SDK and the well-formed libraries that are available to us to develop with, the most exciting feature for Android developers is that we now have access to anything the operating system has access to. In other words, if you want to create an application that dials the phone, you have access to the phone’s dialer; if you want to create an application that utilizes the phone’s internal GPS (if equipped), you have access to it. The potential for developers to create dynamic and intriguing applications is now wide open.On top of all the features that are available from the Android side of the equation, Google has thrown in some very tantalizing features of its own. Developers of Android applications will be able to tie their applications into existing Google offerings such as Google Maps and the omnipresent Google Search. Suppose you want to write an application that pulls up a Google map of where an incoming call is emanating from, or you want to be able to store common search results with your contacts; the doors of possibility have been flung wide open with Android.Chapter 2 begins your journey to Android development. You will learn the how’s and why’s of using specific development environments or integrated development environments (IDE), and you will download and install the Java IDE Eclipse.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 otheractivities 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 musicas 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 anactivity 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 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.Key Skills & Concepts●Creating new Android projects●Working with Views●Using a TextView●Modifying the main.xml fileCreating Your First Android Project in EclipseTo start your first Android project, open Eclipse. When you open Eclipse for the first time, it opens to an empty development environment (see Figure 5-1), which is where you want to begin. Your first task is to set up and name the workspace for your application. Choose File | New | Android Project, which will launch the New AndroidProject wizard.CAUTION Do not select Java Project from the New menu. While Android applications are written in Java, and you are doing all of your development in Java projects, this option will create a standard Java application. Selecting Android Project enables you to create Android-specific applications.If you do not see the option for Android Project, this indicates that the Android plugin for Eclipse was not fully or correctly installed. Review the procedure in Chapter 3 for installing the Android plugin for Eclipse to correct this.The New Android Project wizard creates two things for youA shell application that ties into the Android SDK, using the android.jar file, and ties the project into the Android Emulator. This allows you to code using all of the Android libraries and packages, and also lets you debug your applications in the proper environment.Your first shell files for the new project. These shell files contain some of the vital application blocks upon which you will be building your programs. In much the same way as creating a Microsoft .NET application in Visual Studio generates some Windows-created program code in your files, using the Android Project wizard in Eclipse generates your initial program files and some Android-created code. In addition, the New Android Project wizard contains a few options, shown next, that you must set to initiate your Android project. For the Project Name field, for purposes of this example, use the title HelloWorldText. This name sufficiently distinguishes this Hello World! project from the others that you will be creating in this chapter.In the Contents area, keep the default selections: the Create New Project in Workspace radio button should be selected and the Use Default Location check box should be checked. This will allow Eclipse to create your project in your default workspace directory. The advantage of keeping the default options is that your projects are kept in a central location, which makes ordering, managing, and finding these projects quite easy. For example, if you are working in a Unix-based environment, this path points to your $HOME directory.If you are working in a Microsoft Windows environment, the workspace pathwill be C:/Users/<username>/workspace, as shown in the previous illustration. However, for any number of reasons, you may want to uncheck the Use Default Location check box and select a different location for your project. One reason you may want to specify a different location here is simply if you want to choose a location for this specific project that is separate from other Android projects. For example, you may want to keep the projects that you create in this book in a different location from projects that you create in the future on your own. If so, simply override the Location option to specify your own custom location directory for this project.。

安卓应用开发中英文对照外文翻译文献

安卓应用开发中英文对照外文翻译文献

安卓应用开发中英文对照外文翻译文献(文档含英文原文和中文翻译)中英文翻译安卓应用开发基础在Java编程语言编写的Android应用程序的Android的SDK工具编译代码以及与任何数据和到一个Android的包,一个归档文件档案资源的.apk后缀,所有的在一个单一的代码.apk文件被认为是一个应用程序,是Android的文件,供电设备来安装应用程序。

一旦安装在设备上,每个Android应用程序的生命在它自己的安全沙箱:而Android操作系统是一个多用户Linux系统中,每个应用程序是一个不同的用户。

默认情况下,每个应用程序的系统分配一个唯一的Linux用户ID (该ID仅用于由系统是未知的应用程序),系统设置所有的应用程序中的文件权限,以便只有用户ID分配给该应用程序可以访问它们。

每个进程都有它自己的虚拟机(VM),因此应用程序的代码在从其他应用程序隔离运行。

默认情况下,每个应用程序运行在它自己的Linux进程。

Android 的启动过程时,应用程序的任何组件需要被执行,然后关闭该进程时,它不再需要或恢复时,系统必须为其他应用程序的内存。

这样一来,Android系统实现了最小特权原则,也就是说,每个应用程序,默认情况下,只能访问的组件,它需要做的工作,没有更多,这将创建一个非常安全的环境,使应用程序无法访问的,这就是它没有给予许可制度的部分。

但是,有一个应用程序的方法与其他应用程序和应用程序访问系统服务的数据:这有可能为两个应用程序安排共享相同的Linux用户ID,在这种情况下,它们能够相互访问的文件。

为了节约使用相同的用户ID系统资源,应用程序还可以安排运行在相同的Linux进程和共享同一个VM (应用也必须使用相同的证书签名)。

应用程序可以请求访问权限,如用户的联系人,短信,可安装存储(SD卡),摄像头,蓝牙等设备的数据,所有应用程序的权限必须由用户在安装时授予。

这涵盖了基本就如何Android应用程序在系统中存在这个文件的其余部分向您介绍:1、框架的核心组件定义应用程序。

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

AndroidAndroid, as a system, is a Java-based operating system that runs on the Linux 2.6 kernel. The system is very lightweight and full featured. Android applications are developed using Java and can be ported rather easily to the new platform. If you have not yet downloaded Java or are unsure about which version you need, I detail the installation of the development environment in Chapter 2. Other features of Android include an accelerated 3-D graphics engine (based on hardware support), database support powered by SQLite, and an integrated web browser.If you are familiar with Java programming or are an OOP developer of any sort, you are likely used to programmatic user interface (UI) development—that is, UI placement which is handled directly within the program code. Android, while recognizing and allowing for programmatic UI development, also supports the newer, XML-based UI layout. XML UI layout is a fairly new concept to the average desktop developer. I will cover both the XML UI layout and the programmatic UI development in the supporting chapters of this book.One of the more exciting and compelling features of Android is that, because of its architecture, third-party applications—including those that are “home grown”—are executed with the same system priority as those that are bundled with the core system. This is a major departure from most systems, which give embedded system apps a greater execution priority than the threadpriority available to apps created by third-party developers. Also, each application is executed within its own thread using a very lightweight virtual machine.Aside from the very generous SDK and the well-formed libraries that are available to us to develop with, the most exciting feature for Android developers is that we now have access to anything the operating system has access to. In other words, if you want to create an application that dials the phone, you have access to the phone’s dialer; if you want to create an application that utilizes the phone’s internal GPS (if equipped), you have access to it. The potential for developers to create dynamic and intriguing applications is now wide open.On top of all the features that are available from the Android side of the equation, Google has thrown in some very tantalizing features of its own. Developers of Android applications will be able to tie their applications into existing Google offerings such as Google Maps and the omnipresent Google Search. Suppose you want to write an application that pulls up a Google map of where an incoming call is emanating from, or you want to be able to store common search results with your contacts; the doors of possibility have been flung wide open with Android.Chapter 2 begins your journey to Android development. You will learn the how’s and why’s of using specific development environments or integrated development environments (IDE), and you will download and install the JavaIDE Eclipse.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 listof 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) drawin 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 theBroadcastReceiver 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 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 thecomponent is available, creating the instance if necessary.Key Skills & Concepts●Creating new Android projects●Working with Views●Using a TextView●Modifying the main.xml fileCreating Your First Android Project in EclipseTo start your first Android project, open Eclipse. When you open Eclipse for the first time, it opens to an empty development environment (see Figure 5-1), which is where you want to begin. Your first task is to set up and name the workspace for your application. Choose File | New | Android Project, which will launch the New Android Project wizard.CAUTION Do not select Java Project from the New menu. While Android applications are written in Java, and you are doing all of your development in Java projects, this option will create a standard Java application. Selecting Android Project enables you to create Android-specific applications.If you do not see the option for Android Project, this indicates that the Android plugin for Eclipse was not fully or correctly installed. Review the procedure in Chapter 3 for installing the Android plugin for Eclipse to correct this.The New Android Project wizard creates two things for youA shell application that ties into the Android SDK, using the android.jar file, and ties the project into the Android Emulator. This allows you to code using allof the Android libraries and packages, and also lets you debug your applications in the proper environment.Your first shell files for the new project. These shell files contain some of the vital application blocks upon which you will be building your programs. In much the same way as creating a Microsoft .NET application in Visual Studio generates some Windows-created program code in your files, using the Android Project wizard in Eclipse generates your initial program files and some Android-created code. In addition, the New Android Project wizard contains a few options, shown next, that you must set to initiate your Android project. For the Project Name field, for purposes of this example, use the title HelloWorldText. This name sufficiently distinguishes this Hello World! project from the others that you will be creating in this chapter.In the Contents area, keep the default selections: the Create New Project in Workspace radio button should be selected and the Use Default Location check box should be checked. This will allow Eclipse to create your project in your default workspace directory. The advantage of keeping the default options is that your projects are kept in a central location, which makes ordering, managing, and finding these projects quite easy. For example, if you are working in a Unix-based environment, this path points to your $HOME directory.If you are working in a Microsoft Windows environment, the workspace path will be C:/Users/<username>/workspace, as shown in the previous illustration. However, for any number of reasons, you may want to uncheck theUse Default Location check box and select a different location for your project. One reason you may want to specify a different location here is simply if you want to choose a location for this specific project that is separate from other Android projects. For example, you may want to keep the projects that you create in this book in a different location from projects that you create in the future on your own. If so, simply override the Location option to specify your own custom location directory for this project.______________________________________________________________________________________________________________Welcome To Download !!!欢迎您的下载,资料仅供参考!精品资料。

相关文档
最新文档