xiaowangXIAOWANG1
haha1
2016-07-04 01:26

AIDL获取aidl文件自动生成的java类的对象为空的问题

public void onServiceConnected(ComponentName arg0, IBinder service) {
//拿到远程服务
imediaPlaybackService = IMediaPlaybackService.Stub.asInterface(service);
Log.i(TAG,"拿到服务");
}

 long Id =imediaPlaybackService.removeTrack(num1 );
                textview.setText("Id");

报错提示如下
01-03 15:22:37.936: E/AndroidRuntime(3665): java.lang.NullPointerException: Attempt to invoke interface method 'int com.android.music.IMediaPlaybackService.removeTrack(long)' on a null object reference
01-03 15:22:37.936: E/AndroidRuntime(3665): at com.music.musicaidltest.MainActivity.onClick(MainActivity.java:68)

其中imediaPlaybackService是aidl的java类IMediaPlaybackService这的对象,请问有谁知道可能是什么情况造成

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐

换一换