【Android源码 栏目提醒】:网学会员Android源码 为您提供Android系统开发毕业设计 - 企业软件开发参考,解决您在Android系统开发毕业设计 - 企业软件开发学习中工作中的难题,参考学习。
The
Android system is the development of a Google open source mobile OS
Android Chinese name by domestic users commonly known as
android.
Android operating system based on Linux kernel design using a Google company developed its own Dalvik Java virtual machine.
Android operating system has become the worlds largest intelligent mobile phone operating system. The Open Handset Alliance 1 released the Google
Android SDK having announced it about a week before. The impact was unbelievablealmost every IT/programming-related news-page dumped a news-post about the SDK release – the Google Groups 2 was overwhelmed with over 2000 Messages within the first two Days. The idea of the
Android Platform was and still is amazing and is of course attracting more and more programmers every day. Especially the open architecture based on Intents and the possibility to replace even the Home-application grant a really large amount of flexibility to the whole platform.
Android was built from the ground-up to enable developers to create compelling mobile applications that take full advantage of all a handset has to offer. It is built to be truly open. For example an application could call upon any of the phones core functionality such as making calls sending text messages or using the camera allowing developers to create richer and more cohesive experiences for users.” This is true as a developer you can do everything from sending short messages with just 2 lines of code up to replacing even the HOME- Screen of your device. One could easily create a fully customized operating system within weeks providing no more of Google’s default application to the user.
Android is built on the open Linux Kernel. Furthermore it utilizes a custom virtual machine that has been designed to optimize memory and hardware resources in a mobile environment.
Android will be open source it can be liberally extended to incorporate new cutting edge technologies as they emerge. The platform will continue to evolve as the developer community works together to build innovative mobile applications.Here Google is talking of the so called Dalvik virtual machine DalvikVM which is a register based virtual machine designed and written by Dan Bornstein and some other Google engineers to be an important part of the
Android platform. In the words “register based” we find the first difference to normal Java virtual machines JVM which are stack based. See the “Dalvik.equalsJava false”-chapter for more details on that issue.
Android does not differentiate between the phones core applications and third-party applications. They can all be built to have equal access to a phones capabilities providing users with a broad spectrum of applications and services. With devices built on the
Android Platform users will be able to fully tailor the phone to their interests. They can swap out the phones home screen the style of the dialer or any of the applications. They can even instruct their phones to use their favorite photo viewing application to handle the viewing of all photos.
Android breaks down the barriers to building new and innovative applications. For example a developer can combine information from the web with data on an individuals mobile phone - such as the users contacts calendar or geographic location - to provide a more relevant user experience. With
Android a developer could build an application that enables users to view the location of their friends and be alerted when they are in the vicinity giving them a chance to connect.
Android provides access to a wide range of useful libraries and tools that can be used to build rich applications. For example
Android enables developers to obtain the location of the device and allows devices to communicate with one another enabling rich peer-to-peer social applications. In addition
Android includes a full set of tools that have been built from the ground up alongside the platform providing developers with high productivity and deep insight into their applications.
Android application development is through the rich and informative examples demonstrate the
Android platform in the development of mobile phone application software necessary concepts and techniques. We not only need to
Android application development environment and debugging method carries on the detailed understanding but also to the
Android software development of some key technology and API applications including database localization and map a graphical user interface interprocess communication and mobile phone calls for Mastery Since the Web 2.0 revolution making content rich applications within minutes is no more illusion.
Android has brought developing to unknown speeds. Let me provide an example: Someday I stumbled over the Buzzword ‘DrivingDirections’ within the
Android-Documentation. Google emphasizes Androids power of providing location-based-services. Google Maps are so neat within
Android as if it was just developed for
Android. One can integrate a fully zoom and drag enabled map by adding just 3 characters in the Java-Code of the
Android-Default-Application and 3 lines of XML-Code. Other nice features that are easy to use with
Android are Animations and media-playback. Since version m5 the
Android SDK contains functions for straight and reverse GeoCoding and in addition to mp3 playback of: ogg-Vorbis MIDI and a bunch of other formats. The
Android Code Challenge ADC is an idea of Google to encourage the community to build cool applications for the
Android Platform by rewarding the 50 most promising applications submitted Of course the
Android Developers Challenge with its overall 10 Million Dollars of prize money was attracting even more software-developers to create a bunch of really useful applications. On the other side many voices said that this was no good choice from Google because it would lead to less code-sharing as many would fear sharing their ideas with a community during the first important months after the SDK release. There were two Challenges planned:
Android Developer Challenge I: Submissions up to April 14 2008
Android Developer Challenge II: This part will launch after the first handsets built on the platform become available in the second half of 2008. In the
Android Developer Challenge I the 50 most promising entries submitted by April 14 will each receive a 25000 award to fund further development. Those selected will then be eligible for even greater recognition via ten 275000 awards and ten 100000 awards. Applications submitted to the Challenge were supposed to be innovative and demonstrate all the capabilities of the
Android platform like location based services media consumption gaming and social networking to enrich mobile experience. In the
Android Developer Challenge II: Creating
Android Applications Anatomy of an
Android Application There are four building blocks to an
Android application: . Activity . Intent Receiver . Service . Content Provider Not every application needs to have all four but your application will be written with some combination of theseOnce you have decided what components you need for your application you should list them in a file called AndroidManifest.xml. This is an XML file where you declare the components of your application and what their capabilities and requirements are. We will discuss soon what the AndroidManifest.xml is responsible Activity Activities are the most common of the four
Android building blocks. An activity is usually a single screen in your application. Each activity is implemented as a single class that extends the Activity base class. Your class will display a user interface composed of Views and respond to events. Most applications consist of multiple screens. For example a text messaging application might have one screen that shows a list of contacts to send messages to a second screen to write the message to the chosen contact and other screens to review old messages or change settings. Each of these screens would be implemented as an activity. Moving to another screen is accomplished by a starting a new activity. In some cases an Activity may return a value to the previous activity - for example an activity that lets the user pick a photo would return the chosen photo to the caller. When a new screen opens the previous screen is paused and put onto a history stack. The user can navigate backward through previously opened screens in the history. Screens can also choose to be removed from the history stack when it would be inappropriate for them to remain.
Android retains history stacks for each application launched from the home screen. Intent and Intent Filters
Android uses a special class called Intent to move from screen to screen. Intent describe what an application wants done. The two most important parts of the intent data structure are the action and the data to act upon. Typical values for action are MAIN the front door of the application VIEW PICK EDIT etc. The data is expressed as a Uniform Resource Indicator URI. For example to view a website in the browser you would create an Intent with the VIEW action and the data set to a Website-URI. There is a related class called an IntentFilter. While an intent is effectively a request to do something an intent filter is a description of what intents an activity or intent receiver see below is capable of handling. An activity that is able to display contact information for a person would publish an IntentFilter that said that it knows how to handle the action VIEW when applied to data representing a person. Activities publish their IntentFilters in the AndroidManifest.xml file. Navigating from screen to screen is accomplished by resolving intents. To navigate forward an activity calls startActivitymyIntent. The system then looks at the intent filters for all installed applications and picks the activity whose intent filters best matches myIntent. The new activity is informed of the intent which causes it to be launched. The process of resolving intents happens at run time when startActivity is called which offers two key benefits: Activities can reuse functionality from other components simply by making a request in the form of an Intent . Activities can be replaced at any time by a new Activity with an equivalent IntentFilter Intent Receiver You can use an IntentReceiver when you want code in your application to execute in reaction to an external event for example when the phone rings or when the data network is available or when its midnight. Intent receivers do not display a UI although they may display Notifications to alert the user if something interesting has happened. Intent receivers are also registered in AndroidManifest.xml but you can also register them from code using Context.registerReceiver. Your application does not have to be running for its intent receivers to be called the system will start your application if necessary when an intent receiver is triggered. Applications can also send their own intent broadcasts to others with Context.broadcastIntent. Service A Service is code that is long-lived and runs without a UI. A good example of this is a media player playing songs from a play list. In a media player application there would probably be one or more activities that allow the user to choose songs and start playing them. However the music playback itself should not be handled by an activity because the user will expect the music to keep playing even after navigating to a new screen.In this case the media player activity could start a service using Context.startService to run in the background to keep the music going The system will then keep the music playback service running until it has finished. You can learn more about the priority given to services in the system by reading Life Cycle of an
Android Application. Note that you can connect to a service and start it if its not already running with the Context.bindService method. When connected to a service you can communicate with it through an interface exposed by the service. For the music service this might allow you to pause rewind etc. Content Provider Applications can store their data in files a SQLite database preferences or any other mechanism that makes sense. A content provider however is useful if you want your applications data to be shared with other applications. A content provider is a class that implements a standard set of methods to let other applications store and retrieve the type of data that is handled by that content provider Applications can store their data in files an SQLite database or any other mechanism that makes sense. A content provider however is useful if you want your applications data to be shared with other applications. A content provider is a class that implements a standard set of methods to let other applications store and retrieve the type of data that is handled by that content provider. To get more details on content providers see Accessing Content Providers.
Android User Interfaces UI in
Android can be built within two ways by defining XML-Code or by writing Java-Code. Defining the GUI structure in XML is highly preferable because as one knows from the Model-Viewer-Control principle that the UI should always be separated from the program-logic. Additionally adapting a program from one screen-resolution to another is a lot easier. Hierarchy of Screen Elements The basic functional unit of an
Android application is the activity-an object of the class
android.app.Activity. An activity can do many things but by itself it does not have a presence on the screen. To give your activity a screen presence and design its UI you work with views and viewgroups - basic units of user interface expression on the
Android platform. Views A view is an object extending the base class
android.view.View. Its a data structure whose properties store the layout and content for a specific rectangular area of the screen. A View object handles measuring its layout drawing focus changes scrolling and key/gestures for the screen area it represents. The View class serves as a base class for all widgets - a set of fully implemented subclasses that draw interactive screen elements. Widgets handle their own measuring and drawing so you can use them to build your UI more quickly. The list of widgets available includes i.e. TextView EditText Button RadioButton Checkbox ScrollView ?? Viewgroups A viewgroup is an object of class
android.view.Viewgroup. As its name indicates a viewgroup is a special type of view object whose function is to contain and manage a subordinate set of views and other viewgroups Viewgroups let you add structure to your UI and build up complex screen elements that can be addressed as a single entity. The Viewgroup class serves as a base class for layouts - a set of fully implemented subclasses that provide common types of screen layout. The layouts give you a way to build a structure for a set of views. A Tree-Structured UI On the
Android platform you define an Activitys UI using a tree of view and viewgroup nodes as shown in the diagram below. The tree can be as simple or complex as you need to make it and you can build it up using Androids set of predefined widgets and layouts or custom view types that you create yourself. To attach the tree to the screen for rendering your Activity calls its setContentView method and passes a reference to the root node object. Once the
Android system has the reference to the root node object it can work directly with the node to invalidate measure and draw the tree. When your Activity becomes active and receives focus the system notifies your activity and requests the root node to measure and draw the tree. The root node then requests that its child nodes draw themselves - in turn each viewgroup node in the tree is responsible for drawing its direct children.