Listing 95 Implementing binding on a Service Available for

download on private final IBinder binder = new MyBinder(); Wrax.com

©Override public IBinder onBind(Intent intent) { return binder;

public class MyBinder extends Binder { MyService getService() { return MyService.this;

The connection between the Service and Activity is represented as a ServiceConnection. You'll need to implement a newServiceConnection, overriding the onServiceConnected and onServiceDisconnected methods to get a reference to the Service instance once a connection has been established, as shown in Listing 9-6.

Mobile Apps Made Easy

Mobile Apps Made Easy

Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.

Get My Free Training Guide


Post a comment