34,333
edits
Changes
→A Local Bound Service Example
The example application created in the remainder of this chapter will consist of a single activity and a bound service. The purpose of the bound service is to obtain the current time from the system and return that information to the activity where it will be displayed to the user. The bound service will be local and private to the same application as the activity.
Begin, therefore, by creating a new Android project named LocalBound containing a single blank activity named LocalBoundActivity with a corresponding layout and fragment files named activity_local_boundand fragment_local_bound respectively. Once the project has been created, the next step is to add a new class to act as the bound service.
== Adding a Bound Service to the Project ==