¡@

Home 

2014/10/16 ¤W¤È 08:18:00

android Programming Glossary: localbinder

How to move Bluetooth activity into a Service

http://stackoverflow.com/questions/15025852/how-to-move-bluetooth-activity-into-a-service

public IBinder onBind Intent intent mHandler MyAplication getApplication .getHandler return mBinder public class LocalBinder extends Binder PrinterService getService return PrinterService.this private final IBinder mBinder new LocalBinder @Override.. LocalBinder extends Binder PrinterService getService return PrinterService.this private final IBinder mBinder new LocalBinder @Override public int onStartCommand Intent intent int flags int startId Log.d PrinterService Onstart Command mBluetoothAdapter..

Android:sound pool and service

http://stackoverflow.com/questions/5580537/androidsound-pool-and-service

services.html public class LocalService extends Service Binder given to clients private final IBinder mBinder new LocalBinder Random number generator private final Random mGenerator new Random private SoundPool soundPool private HashMap Integer Integer.. we know this service always runs in the same process as its clients we don't need to deal with IPC. public class LocalBinder extends Binder LocalService getService Return this instance of LocalService so clients can call public methods return LocalService.this.. ComponentName className IBinder service We've bound to LocalService cast the IBinder and get LocalService instance LocalBinder binder LocalBinder service mService binder.getService mBound true public void onServiceDisconnected ComponentName arg0..