"Android Learning Note 1" Android Basic components Activity,service,boradcastreceiver,contentprovider Introduction

Source: Internet
Author: User

Because bloggers have learned a bit about Android before, so the study notes are not the same as others.

Blogger's study reference book is crazy Android handout second edition. This series of blogs is a record of learning notes.

Because bloggers usually have to work, so also at night sometimes read, write blog.

The blogger insists on reading one hours a day and documenting his essays.

Hope to bring you help.

===========================================================================

Basic components of Android

===========================================================================

The basic components of Android are Activity,service,broadcastlistener,contentprovider and so on.

1. Activity && View

Activity is similar to JFrame, but more than jframe can do. Unlike JFrame, activity is just a form, and the content to display is done by view

View is the base class for all UI controls, and one activity may have many view, which can be specified by Setcontentview (r.layout.view name).

2. Service

Service and activity are similar, but I simply understand that there is no graphical interface to the activity. Mostly running in the background, with their own independent life cycle.

3. Broadcastlistener

As the name implies, it is a broadcast listener, similar to the concept of a listener in Java, but the listener in Java listens to an object, while an Android listener listens to

The major components in the application. Of course, it is not listening to all messages, just listening to the message types defined in Intentfilter.

4. ContentProvider

ContentProvider is primarily used for data communication between applications, and is a standard that Android provides for cross-application communication.

5. Intent && Intentfilter

Strictly speaking, intent is not a basic component, but a carrier of communication between components. Communication between the Activity,service,broadcastreceiver is

Take intent as the carrier.

Intent is also divided into display intent and implicit intent

Display Intent: Explicitly indicates the class name of the component that needs to be started or triggered

Implicit intent: Just specify what conditions should be met by the component that needs to be started or triggered

For the implicit intent,android system, it is necessary to parse it and parse out its conditions, which will be used intentfilter.

The above is a preliminary understanding of the basic components.

"Android Learning Note 1" Android Basic components Activity,service,boradcastreceiver,contentprovider Introduction

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.