Android Developer documentation so to speak:
Content providers manage access to a structured set of data. They encapsulate the data, and provide mechanisms for defining data security.
In layman's words, ContentProvider is a data wrapper. It provides a unified interface to manipulate data, and the user does not care about how the data is stored and what the data type is. The ContentProvider encapsulates the data so that it is easy to manage the data. It is mainly used for sharing information among different applications and between different processes.
Why are there ContentProvider?
As we all know, access to data involves taking into account the security of the data. How to ensure the security of data at the same time, but also convenient access to data?
As we all know, the Android system is based on the Linux kernel. In Linux, files have a list of properties, such as file permissions, as in. Different users or groups of users have different permissions to read, write, and execute files. R (Read), W (Write), X (Execute),-(no permission).
Android is Linux-based and also inherits the way Linux is managed, and usually each application is a separate process, that is, a different user. Android assigns a separate user ID and user group ID to each application. And the files created by this application are given the appropriate read and write permissions. Other applications are not authorized to access.
This guarantees the security of the data, but the sharing of the data has caused inconvenience to the third party. The developer of the Android system designed the ContentProvider class to solve the problem. Content provider A good balance between the two.
1.3Android the official ContentProvider
Android Official provides some contentprovider to facilitate the development of third-party developers. The provider of these standards are defined in the Android.provider.
2.Content URI
Before you understand the content URI, understand the following URI.
URI: The Universal Resource Identifier (Uniform Resource Identifier, referred to as the "URI") is primarily used for locating each resource-html documents, images, video clips, programs, etc. available on the web.
Resources on Android can also be represented by URIs.
This is how the URI is described in the document:
A content URI is a URI, which identifies data in a provider. Content URIs include the symbolic name entire provider (its authority) and a name, points to a table (a path). The Content URI consists of three parts: "content://", hostname (or understanding of Domain name Authority), path (path, where ID is optional).
For example:
Word table for user dictionary:content://user_dictionary/word
All pictures stored on the device:content://media/internal/images
Contact information:content://contacts/people
Contact information for a person:content://contacts/people/1
Use the parse method of the URI to convert the string to a URI:<Uri uri = Uri.parse("content://com.ijtsai.contactprovider/people");>
Http://www.cnblogs.com/JohnTsai/p/4034062.html
These methods define the full life cycle of the activity and implement these methods, and we can monitor three nested loops in the Activity life cycle (monitor three nested loops in the activity lifecycle)1.Activity of entire lifetime(all lifetimes) occurs incall onCreate () and call ondestory () . In the OnCreate () method, perform a global State establishment (for example, define a layout) and release all saved resources in the OnDestroy () method. The visible lifetimeof the 2.Activity (visual lifetime) occurs incalls between OnStart () and onStop () . during this time, the user can see the activity on the screen and interact with it. The system may call OnStart () and OnStop () multiple times in the full life of the activity, just as the activity is alternately visible or hidden to the user. 3Activity foreground lifetime (the life of the foreground) occurs incalls between Onresume () and onPause () . during this time, the activity is in front of all other activity on the screen, with the user input focus. an activity can change frequently between the front entrance and the outside.
Http://www.cnblogs.com/JohnTsai/p/4052676.html
Android (Digest)