Quick access to Android World (top)

Source: Internet
Author: User
Tags home screen

Android Overview Android is what Android is a Linux-based open-source operating system and application that is used primarily for portable devices.
The Android operating system was originally developed by Andy Rubin, initially primarily supported by mobile phones.
The 2005 was funded by Google's takeover, and an open mobile alliance was developed to expand into tablet computers and other areas.
In the first quarter of 2011, Android's market share in the world surpassed the Symbian system for the first time in the world.
November 2011 data, Android occupies 52.5% of the global smartphone operating system market share, China's market share of 58%.
Android Name Source 

the word Android first appeared in French writer Liriadan (Auguste Villiers de l ' Isle-adam) in 1886, The " Future Eve" of science Fiction (L ' Ève). He will look like a human machine named Android.

Version of Android

android1.1
...
android4.0

android4.1

...

Android Development Direction System Development

Extended operating system features are difficult, Android bottom -upusing C C + + development. Development of Android system, in addition to the need for Java in-depth understanding and development experience, but also need to have a deep understanding of C and C + + and enough development experience

Application Development

Developing Applications is generally difficult

Android's system architecture

Application Layer Applications are programs written in the Java language that run on virtual machines.
Application Framework Layer 

This layer is the API framework used to write the core apps that Google publishes, and developers can use these frameworks to develop their own applications, which simplifies the framework design of program development, but must adhere to the development principles of their frameworks.

System run-level library When using the Android app framework, the Android system supports the various components we use through a number of C + + libraries, so that they can better serve us. Linux kernel Layer 

Android's core system serves the Linux2.6 kernel, such as security, memory management, process management, network protocol stacks, and driver models, all of which depend on the kernel. The Linux kernel also acts as an abstraction layer between the hardware and the software stack.

Development environment Construction Here mainly under Eclipse development under the environment, the official now recommended Android Studio, about Android Studio I was just beginning to contact, I will meet the problems summed up, later in the form of blog post to share. Android Development Preparation work Required Software:
Jdk 1.5 or higher (recommended with JDK1.6 version), Eclipse3.5 or higher (3.7 version recommended),Android SDKAndroid SDK 4.0.3,AdtADT 20.0.2Android Development Environment Construction Installing the SDK
SDK is an Android development kit that contains APIs for developing Android apps
SDK requires JDK1.5 and above to install the JDK before installing the SDK
The Official SDK:
Http://developer.android.com/sdk/index.htmlAfter downloading, double-click Install
After installing the SDK is just an SDK version of the manager, click on the SDK Manager, which manages the Android SDK is the version of the Android system tick click Install packages can download

Android Version:

1.X earlier mobile version 2.X Mainstream mobile phone version 3.X Tablet PC version 4.X is 2. X and 3.X integrated version, can be used on the phone or tablet

Configuring environment Variables for the SDK

Locate the installation path for the SDK
Open the Tools folder


Add to environment variable path

Open the Platform-form-tools folder The same reason, after the path is copied, add the environment variable path to install the ADT plugin ADT
Using eclipse to not develop Android applications directly using the SDK requires adding eclipse support for the SDK, which means that eclipse requires plugins to support the SDK
This plugin is--adt
Download ADT
To download the ADT plugin, the version number of the ADT plugin must match the version number of the downloaded SDK
Launch Eclipse, "help" → "Install New software ..." → "add" to specify the path of ADT, click OK



Click Finish to complete the installation, if the warning appears as shown, click OK to continue the installation
The following prompt appears, the installation succeeds, and the Eclipse is restarted
If the Android icon appears on the toolbar, the plugin is installed successfully

Configuring the SDK in Eclipse

Click Windows→preferences→android

Create AVD (Simulator) AVDThe full name of the AVD is Android virtual device, which is an Android-run dummy, the analog phone.
Create AVD

Click the icon

Click Create AVD


Click Start to appear in the following window click Launch Launch simulatorafter successful launch, you will see an analog phone screen
First HelloWorld Program

Create an Android project


Click Next until the Finish button can be clicked

Run the program

Click on the project right button


Run results


Directory structure for Android projects
Gen When a resource is added to the Res folder, it is automatically generated within R.java, which represents the variable that adds the resource, and accesses the resource directly by accessing the variable (that is, the R. Variable name). For example: When adding picture A to drawable-hdpi. JPG, the R class automatically adds a variable res:android component that represents a.jpg activity (Activities):

Activity is the most basic Android application component in an application where an activity is usually a separate screen. Each activity is implemented as a separate class and inherits from the active base class, which displays the user interface consisting of the view control and responds to the event. Most applications are made up of multiple screen displays. For example, the application of a text message may have a contact list screen that displays the sending message, a second screen to write text messages and select recipients, and a screen to view message history or message setup operations. Each of these screens is an activity that is easy to implement from a screen to a new screen and complete the new activity. In some cases, the current screen may need to provide a return value to the previous screen activity-for example, to have the user pick a photo from the phone to return to the Address book as the caller's avatar.

When a new screen is opened, the previous screen is paused and saved in the history stack. The user can return to the previous screen in the history stack. When the screen is no longer in use, it can also be removed from the history stack. By default, Android retains the run screen from the home screen to each app.
Simply understand that activity represents a screen that a user can see, activity is mainly to deal with an application's overall work, such as monitoring system events (key events, touch screen events, etc.), displaying the specified view for the user, initiating other activities, etc. All of the app's activities are inherited from the Android.app.Activity class, which is the base class provided by Android, and other activities that inherit the parent class are implemented through the override of the parent class, a design that is more common in other areas.

Service (Services):

A service is a section of a life cycle, without a user-interface program. A good example is a media player that is playing songs from a playlist. In a media player application, there should be multiple activity, allowing the user to select songs and play songs. However, there is no activity associated with the music replay because the user will of course think that the music should still be playing when navigating to other screens. In this example, the Media Player activity uses context.startservice () to start a service so that it can keep the music playing in the background. At the same time, the system will keep the service running until the end of the service run. In addition we can also connect to a service by using the Context.bindservice () method (if the service is not running it will start it). When connected to a service, we can also communicate with it by the interface provided by the service. Take the Media Player example, we can also pause, replay and other operations.

ContentProvider (content Provider):

Android apps can save their data to files, SQLite databases, or even any valid device. When you want to share your app data with other apps, the content provider can work. Because the content provider class implements a standard set of methods, it enables other applications to save or read various data types that are processed by this content provider. Data is at the heart of your application. In Android, the default is to use the famous SQLite as System db. But in Android, the use of the method is a little different. Every app in Android runs in its own process, and when your app needs to access data from other apps, it also requires data to be passed between different virtual machines, which can be difficult to manipulate (normally you can't read other DB files for the app), ContentProvider is the tool used to solve the sharing of data between different application packages.

Broadcastreceiver (Broadcast recipient):

A broadcast receiver is such a component that it does nothing but receives a broadcast announcement and responds accordingly. Many broadcasts originate from system code, such as the announcement of time zone changes, low battery power, pictures taken, and user-changed language preferences. Applications can also initiate broadcasts, for example, in order for other programs to know that certain data has been downloaded to the device and that they can use the data. An application can have any number of broadcast receivers to react to any announcements it deems important. All recipients inherit from the Broadcastreceiver base class. The broadcasts in Android are either from the system or from a common application. Many events can result in system broadcasts, such as changes in the time zone of the phone, low battery level, and user changes to system language settings. Some data from a common application, such as an application that notifies other applications, has already been downloaded.

To respond to different event notifications, the application can register a different broadcast Receiver. All broadcast receiver inherit from the base class Broadcastreceiver. The broadcastreceiver itself does not implement a graphical user interface, but when it receives a notification, Broadcastreceiver can initiate activity as a response or alert the user through Notificationmananger. Broadcastreceiver is a class of components that are filtered to receive and respond to a sent broadcast.

Intent (intention):

Android uses the intent special class to move between the screen and the screen. The intent class is used to describe what an application will do. In the description structure of intent, there are two most important parts: the data corresponding to the action and the action. Typical types of actions are: MAIN (activity Portal), VIEW, PICK, edit, and so on. The data corresponding to the action is represented in the form of a URI. For example, to see a person's contact, you need to create a intent with the action type view and a URI that represents the person. A class that has a relationship with it is called Intentfilter. As opposed to intent is a valid request to do something, a intentfilter is used to describe which intent an activity (or intentreceiver) can manipulate. An activity if you want to display a person's contact information, you need to declare a intentfilter, this intentfilter to know how to handle the view action and the URI that represents a person. Intentfilter needs to be defined in Androidmanifest.xml. By parsing various intent, navigating from one screen to another is simple. When navigating forward, the activity invokes the StartActivity (Intentmyintent) method. The system then looks in the Intentfilter defined in all installed applications to find the activity that best matches myintent's intent. After the new activity receives the MYINTENT notification, it starts to run. This mechanism provides two key benefits when the StartActivity method is invoked to trigger an action that parses the myintent:

A, activities is able to reuse a request generated from other components in the form of intent.
B, activities can be replaced at any time by a new activity with the same intentfilter.


PS:CSDN Editor to write blog too troublesome, especially typesetting, fortunately, now support Markdown Grammar. Still want to be able to concentrate more on content, rather than typesetting, markdown solves this problem.

Quick access to Android World (top)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.