Android Four components

Source: Internet
Author: User

Activity:

Oncreat () OnStart () Onrestart () Onresume () OnPause () OnStop () ondestory ()

Four basic statuses: pause and stop pending in the event

Standard mode creates a new activity

Singletop mode call top activity does not create a new

Singletask mode an activity instance has only one

SingleInstance Mode New Task

Resume Activity Onsaveinstancestate () Oncreat () {Savedinstancestate.get ()}

Intent:

Action data category type component Extras flag

Show Intent SetComponent () SetClass ()

Implicit Intent-Interfilter

Broadcastreceeiver:

Inheriting Broadcastreceiver implementing the Onreceiver () function

Static registration Androidmanifest.xml Dynamic Registration Oncreat () or OnStart () in the Register onStop () or ondestory () revocation

Regular broadcast ordered broadcast (Intent-filter priority)

Service:

OnCreate () Onstartcommand () Onbind (return null) OnDestroy ()

StartService ()->oncreate ()->onstartcommand ()->running-> OnDestroy ()

The start form of the Service inheritance service (executed in the main thread) inherits Intentservice (creating a new thread serial execution) simply implements the Onhandleintent () method

Bindservice ()->oncreate ()->onbind (return ibinder), binded-> onunbind ()->ondestroy ()

A binding form of service inheritance service creates a inner class inherits binder creation GetService (return outerservice.this) method

Serviceconnection class: Onserviceconnected (), onservicedisconnected ()

Contentprivoder:

OnCreate () query () update () getType () Delete () insert () Uri.parse (String)

Getcontentresolver () android:authorities

Android Four components

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.