傻啦吧唧的程序员丶

Android中Activity和Service的绑定(一)

public class BindService extends Service {

    
    private static final String TAG = "BindService";
    
    private MyBinder binder = new MyBinder();
    
    public class MyBinder extends Binder {
        
        public BindService getService () {
            
            return BindService.this;
        }
    }
    public IBinder onBind(Intent intent) {

        return binder;
    }
    
    public void MyMethod() {
        
        Log.i(TAG, "This is MyMethod()");
    }

}

 

posted on 2012-09-15 20:32  傻啦吧唧的程序员丶  阅读(119)  评论(0编辑  收藏  举报

导航