当前位置: 代码迷 >> Java相关 >> android 关于服务连接的疑义
  详细解决方案

android 关于服务连接的疑义

热度:5593   发布时间:2013-02-25 21:43:46.0
android 关于服务连接的疑问
已建立IMediaPlayService.aidl ,。。。有:boolean  flag =  this.bindService (mintent, serviceConn, Context.BIND_AUTO_CREATE);
                         if ( flag){
                                 Log.i("system","**************** bindService  is successful******");//这句输出了
         
                         }else {
                                 Log.i("system","**************** bindService  is failed ******");
                                  
                         }

private ServiceConnection serviceConn = new ServiceConnection() {

                  @Override
                  public void onServiceDisconnected(ComponentName name) {
                           Log.i("system","=========onServiceDisConnected==========");
               mservice =null;
                   }

                  @Override
                  public void onServiceConnected(ComponentName name, IBinder service) {
                         
                   mservice= IMediaPlaybackService.Stub.asInterface(service);
                   Log.i("system","=========onServiceConnected==========");
                  
                  }
                 };
绑定服务 log显示绑定成功,但mservice 是空的 不知为何,?求指点public void onServiceConnected(ComponentName name, IBinder service) 这个函数也没执行,怎么回事啊结束了。。。。。。。
  相关解决方案