The Libraries
The libraries
Also the component libraries to share its space with the runtime component. The libraries component acts as a translation layer between the kernel and the application framework. The libraries are written in C / C ++ but are exposed to developers through a Java API. Developers can use the Java application framework to access the underlying core C / C ++ libraries. Some of the core libraries include the following:
LibWebCore: Allows access to the web browtheser
Media Libraries: Allow access to popular audio - and video-recording and playback functions
Graphic libraries: Allows access to 2D and 3D graphics engines drawing
The runtime component Dalkviik Consist of the virtual machines that will Interact and run applications. The virtual machines is an important part of the android operating system and executes the system third-party applications.
The Dalvik Virtual Machine
And Bornstein originally wrote the Dalvik virtual machine. He named it after a small fishing village in Iceland where he Believed one of his ancestors once Originated. The Dalvik VM was written primarily to allow the application execution on devices with very limited resources. Typically, mobile phones will fall into this category Because they are limited by processing power, the amount of memory availabl, and a short battery life.
WHAT IS A VIRTUAL MACHINE?
A virtual machine is an isolated, the guest operating system running another whitin the host operating system. A virtual machine will execute applications as if they were running on a physical machine. One of the main advantages of a virtual machine is portability. Regardless of the underlying hardware, the code that you write will work on the VM. T o you as a developer, this means that you write your code only once and can execute it on any hardware platform that runs a compatible VM.
The Dalvik VM executes. dex files. A. dex file made by taking the compiled Java.class or.jar files and consolidating all the constants and the data within each.class files into a shared constant pool (see Figure 1-3). The dx tool, included in the Android SDK, performs this conversion.
Figure 1-3. Conversion of a.jar file to a.dex file
Table 1-1. A Comparison File Size (in Bytes) of .jar and .dex Files
Application
|
.jar Uncompressed
|
Compresses .jar
|
.dex Uncompressed
|
Common system
|
21445320 = 100%
|
10662048 = 50%
|
10311972 = 48%
|
Libraries
| |||
Web browser app
|
470 312 = 100%
|
232 065 = 49%
|
209 248 = 44%
|
Alarm clock app
|
119 200 = 100%
|
61 658 = 52%
|
53020 = 44%
|
The Application Framework
The application framework is one of the building blocks for the final or end-user system applicantions. Theframework Provides a suite of services or systems that a developer will find useful when writing applications. Commonly Referred to as the API (application programming interface) component, this framework will provide a developer with access to user interface components such as buttons and text boxes, common content providers so that apps may share data between them, a notification manager so that the device owners can be alerted of events, and an activity manager for managing the lifecycle of applications.
As a developer, you will write code and use the APIs in the Java programming language. Listing 1-1, taken from Google's sample API demos(http://developer.android.com/resources/samples/ApiDemos/index.html), demonstates how to use the application framework to play a video file. The import statements in bold allow acces to the core C / C ++ libraries through a Java API.
Listing 1-1. A Video Player Demo (Courtesy of Google, Inc.)
/ *
* Copyright © 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the license.
* You may Obtain a copy of the License at
*
* Htttp: //www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* Distributed under the licenses is distributed on an "AS IS" BASIS,
* WITHOUT warranties OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* Limitations under the License.
* /
Package com.example.android.apis.media;
importcom.example.android.apis.R;
importandroid.app.Activity;
importandroid.os.Bundle;
importandroid.widget.MediaController;
importandroid.widget.Toast;
importandroid.widget.VideoView;
Activity {public class VideoViewDemo
/ **
* TODO: Set the path variable to a streaming video URL or a local media
* File path.
* /
ath private String = "";
privateVideoViewmVideoView;
override
public void onCreate (Bundle icicle) {
super.onCreate (icile);
setContentView (R.layout.videoview);
mVideoView = (VideoView) findViewById (R.id.surface_view);
if (path == "") {
// Tell the user to provide a media file URL / path.
Toast.makeText (
VideoViewDemo.this,
"Please edit VideoViewDemoAcivity, and set path"
+ "Variable to your media file URL / path",
Toast.LENGTH_LONG) .show ();
} else {
Library
Component library also shares space with the runtime component. Component library acts as a translation layer between the kernel and application framework. Library written in C / C ++ but developed through the Java API. Developers can use Java application framework for accessing basic core C / C ++ libraries. Some core libraries include:
LibWebCore: Allows access to the web browser
Media Library: Allows access to popular audio - and video recording-and function media player
Library graphic: Allows access to 2D and 3D machine graphic image
component runtime consists of a virtual machine Dalkviik will interact and run the application. Virtual machines are an important part of the android operating system and executing third-party applications systems. Dalvik Virtual Machine Dan Bornstein originally wrote the Dalvik virtual machine. He gave the name after a small fishing village in Iceland where he believes one of his ancestors originated. The Dalvik VM is written mainly to allow the execution of applications on devices with very limited resources. Normally, the phone would fall into this category because they are limited by the processing power, the amount of memory available, and short battery life.WHAT IS THE VIRTUAL MACHINE? A virtual machine is isolated, the operating system is running in another host operating system. A virtual machine will execute applications as if they were running on a physical machine. One major advantage is the portability of virtual machines. Regardless of the underlying hardware, the code you write will work on the VM. For you as a developer, this means that you write your code only once and can execute on the hardware platform running the VM compatible. The Dalvik VM executes. dex file. A. dex files created by taking Java.class or .jar file is compiled and consolidate all constants and data in each .class file to the constant pool together (see Figure 1-3). Dx devices, including the Android SDK, perform this conversion. After conversion, .dex file - the file has a smaller file size is very significant,
as shown in Table 1-1.
Table 1-1. A Comparison File Size (in Bytes) .jar file and Dex
Applications .jarDex compress compressed compressed .jar general system 21.44532 million = 100% 10,311,972 10,662,048 = 50% = 48% Library Web browser application = 100% 470 312 232 065 209 248 = 49% = 44 % Alarm clock app = 100% 119 200 52% 61 658 = 53020 = 44% Application Framework application framework is one block - the building blocks for the final system or application user - the final application. This framework provides a package of services or systems where developers will find a use when writing applications. Commonly referred to as a component API (application programming interface), the framework will provide developers with access to user interface components such as buttons and text boxes, content providers public so that applications can share data between them, the manager notices that the owner of the device can tell the events, and manager activities to manage the life cycle of applications. As a developer, you will write code and using the APIs in the Java programming language. Listing 1-1, demo samples taken from Google API (http://developer.android.com/resources/samples/ApiDemos/index.html), demonstates how to use an application framework to play video files. Import statements in bold allows access to the core of the C / C ++ libraries via a Java API. Listing 1-1. A Video Player Demo (Courtesy of Google, Inc.) / * * Copyright © 2009 Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * You can not use this file except in compliance with the license. * You can obtain a copy of the License at * * htttp: //www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS", * WITHOUT WARRANTY OR CONDITION OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * / Com.example.android.apis.media package; import com.example.android.apis.R ; import android.app.Activity; import android.os.Bundle; import android.widget.MediaController; import android.widget.Toast; import android.widget.VideoView; public class VideoViewDemo Activity {/ ** * TODO: Set the path variable URL to the video streaming or local media * Path file. * / private String ath = ""; private VideoView mVideoView; @ Override public void onCreate (Bundle es) {super.onCreate (icile); setContentView (R.layout.videoview); mVideoView = (VideoView) findViewById (R.id.surface_view); if (path == "") {// Tell the user to provide media files URL / path. Toast.makeText (VideoViewDemo.this, "Please edit VideoViewDemo Acivity, and set path
+"Variables for your media files URL / path",
Applications .jarDex compress compressed compressed .jar general system 21.44532 million = 100% 10,311,972 10,662,048 = 50% = 48% Library Web browser application = 100% 470 312 232 065 209 248 = 49% = 44 % Alarm clock app = 100% 119 200 52% 61 658 = 53020 = 44% Application Framework application framework is one block - the building blocks for the final system or application user - the final application. This framework provides a package of services or systems where developers will find a use when writing applications. Commonly referred to as a component API (application programming interface), the framework will provide developers with access to user interface components such as buttons and text boxes, content providers public so that applications can share data between them, the manager notices that the owner of the device can tell the events, and manager activities to manage the life cycle of applications. As a developer, you will write code and using the APIs in the Java programming language. Listing 1-1, demo samples taken from Google API (http://developer.android.com/resources/samples/ApiDemos/index.html), demonstates how to use an application framework to play video files. Import statements in bold allows access to the core of the C / C ++ libraries via a Java API. Listing 1-1. A Video Player Demo (Courtesy of Google, Inc.) / * * Copyright © 2009 Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * You can not use this file except in compliance with the license. * You can obtain a copy of the License at * * htttp: //www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS", * WITHOUT WARRANTY OR CONDITION OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * / Com.example.android.apis.media package; import com.example.android.apis.R ; import android.app.Activity; import android.os.Bundle; import android.widget.MediaController; import android.widget.Toast; import android.widget.VideoView; public class VideoViewDemo Activity {/ ** * TODO: Set the path variable URL to the video streaming or local media * Path file. * / private String ath = ""; private VideoView mVideoView; @ Override public void onCreate (Bundle es) {super.onCreate (icile); setContentView (R.layout.videoview); mVideoView = (VideoView) findViewById (R.id.surface_view); if (path == "") {// Tell the user to provide media files URL / path. Toast.makeText (VideoViewDemo.this, "Please edit VideoViewDemo Acivity, and set path
+"Variables for your media files URL / path",
Toast.LENGTH_LONG) .show
();} else {
();} else {