1

我在此代码上收到错误消息:“Binder 调用不正确的接口” :

IBluetoothA2dp ibta = a2dp.connect2.Bt_iadl.ibta2;
    try {
        if (ibta != null && ibta.getConnectionState(device) == 0)
            ibta.connect(device);
        else
            ibta.disconnect(device);

    } catch (Exception e) {
        Log.e(LOG_TAG, "Error " + e.getMessage());
    }

错误出现在ibta.getConnectionState(device)

这就是我之前所做的:

public static ServiceConnection mConnection = new ServiceConnection() {

        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {

            mIsBound = true;
            ibta2 = IBluetoothA2dp.Stub.asInterface(service);
            sendIntent();
        }

        @Override
        public void onServiceDisconnected(ComponentName name) {
            mIsBound = false;
        }
    };

这是我如何使用 .aidl 设置我的包的层次结构:

在此处输入图像描述

我做错了什么。我读了这个问题:SO-Question。但我不知道我做错了什么。

4

0 回答 0