one of the four components: Activity
activity life cycle: Create-to-run (visible actionable): onCreate () OnStart () Onresume ( )
Run-to-destroy (off): OnPause () onStop () OnDestroy ()
Run-stop (invisible and not operable): OnPause () onStop ()
Stop--run Onrestart () OnStart () Onresume ()
Run-to-pause (visible not operable) OnPause ()
Pause-to-run Onresume ()
1.activity creates three main elements: a: Declaring a class inheriting activity B: Associating layout C: Declaring package name in manifest, class name
Jump between 2.Activity (intention): startactivity (Intent);
3.A receives the message returned by the B interface and processes it: the Onactivityresult () method must be rewritten upon receipt (judging the returned content based on the request code and the result code)
4. Button click event: OnClick = "BTN"
In layout: public void btn (View v) {}
two of the four components:
Service Services
1. Service Open: StartService (); Service closed: StopService
2. Binding and unbinding of services: Bindservice (); Unbindservicce ();
Three of the four components:
Broadcastrecevice Broadcast recipient
1. There are two ways to register a broadcast receiver: A: List registration B: Code registration
Difference: A broadcasts can be received regardless of whether the application executes as long as the conditions are met, and B can be received only when the app is running and the conditions are the same.
Filter conditions:
Checklist: Permissions: Receive_sms condition: <cation ... "Android.provider.Telephony.SMS_RECEIVED"/>
Code: Permissions: receive_sms Condition: registerreceiver (Receiver,filter);
Receiver for matching broadcast
Filter for filtering conditions
When you register a broadcast using code, you must unregisterreceiver
Four components:
Content Provider Contents Provider
Android Four components