Android Training Course (41)

Source: Internet
Author: User

In this section, I will start with a simple calculator to analyze the structure, implementation method, source code organization of the android system application, and display the modified Code. By studying system applications, you can learn about android applications, basic knowledge about developing applications, and implementation of android applications, for example, Chinese, multi-language, and adding functions are very important for beginners. Next we will start to learn the calculator application, and then go to the following directory and view the file:

Android-2.0/packages/apps/Calculator

 

In the directory, you can see the following files:

2010-02-21 21:32 AndroidManifest. xml

Android. mk

Arity-1.3.3.jar

2010-02-21 21:32 MODULE_LICENSE_APACHE2

2010-02-21 21:32 NOTICE

Res

2010-02-21 21:32 src

2010-02-21 tests

 

AndroidManifest. xml files are one of the most important files in Android applications. They are the global configuration files of applications and are mandatory files in each android application. They are located in the root directory of the application, describes global data in the package, including components exposed in the package, self-implemented classes, various data that can be processed, startup location, and other important information. The content of this file is as follows:

<? Xml version = "1.0" encoding = "UTF-8"?>

This line describes the XML file standard, which is UTF-8 encoded.

 

<Manifest xmlns: android = "http://schemas.android.com/apk/res/android"

Package = "com. android. calculator2">

The manifest node describes the specifications used by xml, so xmlns points to the android namespace.

The package attribute specifies the package name of the application. Here is com. android. calculator2.

 

<Application android: label = "@ string/app_name" android: icon = "@ drawable/icon">

This line is the property of the application. Android: label indicates the title of the application. It is displayed by reading the app_name string from the application string. Android: icon indicates the application icon, which indicates the icon of the drawable icon in the directory.

 

 

<Activity android: name = "Calculator"

Android: theme = "@ android: style/Theme. Black. NoTitleBar">

This line indicates the window class started by the application. android: name indicates the name of the window class. Here is Calculator. Android: theme indicates the window display style.

 

 

<Intent-filter>

<Action android: name = "android. intent. action. MAIN"/>

<Category android: name = "android. intent. category. LAUNCHER"/>

</Intent-filter>

This section specifies the application entry function at startup, and indicates that the function is displayed in the main window after startup. In fact, the intent-filter node is used for filtering. That is to say, the content in this node indicates the categories that work, otherwise, all the categories work.

Android. intent. action. MAIN determines the Activity that the application starts first. When there are multiple activities in an application, you must specify the Activity that runs first. Otherwise, the virtual machine will not know which Activity to run.

Android. intent. category. LAUNCHER determines whether the application is displayed in the program list. You do not need to add this application to the list.

Therefore, the two items are the description and description of the application entry.

 

</Activity>

</Application>

</Manifest>

The XML description file in the preceding example shows that it contains a lot of important information. Otherwise, the virtual machine will be overwhelmed after loading and running. In fact, you can add more attributes to this file. For details, refer to the SDK development instructions in android.

 

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.