Inheritance of the binder class in three implementation modes of service binding

Source: Internet
Author: User

Application scenarios that inherit the binder class to bind a service: the service is for your own use only (not third-partyProgramDevelopment ).

Note: This method is only applicable when the client and service are in the same program and process.

Implementation Method:

1. Create a binder instance in service:

This instance contains public methods that can be called by the client;

This instance returns the current service object (this service instance contains public methods that can be called by the client)

This instance returns a class object in the service class, which contains the public methods that can be called by the client.

2. Return the binder instance in the onbind function of the service.

3. Obtain the binder instance in the onserviceconnected method of the client, and call the public method of the service through the binder instance.

Demo go to http://pan.baidu.com/share/link? Consumer id = 582094 & UK = 2953765628

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.