android学习笔记1

Android 应用程序四个模块:

1. Activity:称之为“活动”,在应用程序中,一个activity通常就是一个屏幕。每个活动都被实现为独立的类,并将显示由视图控件组成的用户接口,对事件作出响应。

An 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.

2.lntent:用它实现在activity与activity之间的切换。Intent用于描述应用的功能。有两个最重要的部分:动作和动作对应的数据。

3. Content providers:实现了一组标准方法,提供各个应用程序之间数据的相互访问。

A 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.

4.Service:“服务”,生命周期长且没有用户界面的程序。例如后台播放音乐功能。

A 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 more about it in the Services developer guide.

原文地址:https://www.cnblogs.com/cxyzl/p/2535338.html