Seventh Day Android 4 components

Source: Internet
Author: User

1. Activity

2. Broadcastreceiver

3.services

4.contentProvider

A. The broadcast recipient ,---------------trigger the Onreceiver method when the specified broadcast is received. This class needs to inherit Broadcastreceiver

public void OnReceive (context context, Intent Intent) {

Broadcast triggers need to be included in the configuration list

<receiver android:name= "Com.example.ipdailer.CallCast" >            <intent-filter >                <action android: Name= "Android.intent.action.NEW_OUTGOING_CALL"/>            </intent-filter>        </receiver>

Can also be configured by code

Registration of broadcasting, cancellation of registration Unregisterreceiver (receiver);

New mybroadrecastreceiver (); // Create Intent-filter set a broadcast action        New Intentfilter ();        Filter.addaction (Intent.action_screen_off);        Filter.addaction (intent.action_screen_on);         // start registering a broadcast        Registerreceiver (receiver, filter);

Second, the opening way of service service

1. StartService can still exist in memory after the activity is destroyed.

2.bindService destroyed with activity destruction. (You can return a Binder object to return the methods in the service to the activity call through binder)

Seventh Day Android 4 components

Related Article

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.