public class MyTestService extends Service { public class TestBinder extends Binder { MyTestService getService() { return MyTestService.this; } } @Override public IBinder onBind(Intent intent) { return mBinder; } private final IBinder mBinder = new TestBinder(); } // Подключение к сервису .......................................... private MyTestService mBoundService; void doBindService() { private ServiceConnection mConnection = new ServiceConnection() { public void onServiceConnected(ComponentName className, IBinder service) { mBoundService = ((MyTestService.TestBinder)service).getService(); // Здесь service приводится к MyTestService.TestBinder } public void onServiceDisconnected(ComponentName className) { mBoundService = null; } }; bindService(new Intent(this, MyTestService.class), mConnection, Context.BIND_AUTO_CREATE); mIsBound = true; }