简体   繁体   English

在Android Studio中添加.aidl接口

[英]Adding .aidl interafce in android studio

I have two .adil interface in a specific aidl folder but then also It is not recognizing my file.I have followed these steps: I have followed these steps in stackoverflow 我在特定的aidl文件夹中有两个.adil接口,但是它也无法识别我的文件。我已经按照以下步骤进行操作: 我在stackoverflow中已经按照以下步骤进行操作

My .aidl file is: 我的.aidl文件是:

interface IControllerInterface {
/**
 * Init IPCController.
 * @param cmd_type Only support Wearable SDK Controller CMD_8 or CMD_9
 * @param tagName Controller Tag
 */
int init(int cmd_type, in String tagName);

/**
 * Send bytes to Wearable.
 * @param tagName Controller Tag, use your IPCController init tag.
 * @param cmd command string, like "yahooweather yahooweather 1 0 0 "
 * @param dataBuffer byte type of data, like "".getBytes()
 * @param priority default PRIORITY_NORMAL, if set as PRIORITY_HIGH, this session
 *        will get top priority to send.
 */
long sendBytes(in String tagName, String cmd, in byte[] data, int priority);

/**
 * Return connection state.
 * 
 * @see WearableManager#STATE_NONE
 * @see WearableManager#STATE_LISTEN
 * @see WearableManager#STATE_CONNECT_FAIL
 * @see WearableManager#STATE_CONNECT_LOST
 * @see WearableManager#STATE_CONNECTING
 * @see WearableManager#STATE_CONNECTED
 * @see WearableManager#STATE_DISCONNECTING
 */
int getConnectionState();

/**
 * Destroy the IPCController.
 */
void close(String tagName);

/**
 * register IControllerCallback for the "tagName" IPCController.
 */
void registerControllerCallback(in String tagName, in IControllerCallback callback);

/**
 * unregister IControllerCallback for the "tagName" IPCController.
 */
void unregisterControllerCallback(in String tagName, in IControllerCallback callback);

/**
 * get SmartDevice APK remote Bluetooth device Name.
 */
String getRemoteDeviceName();

} }

This is my class where I need to extend it: 这是我上课需要扩展的地方:

private class ControllerBinder extends IControllerInterface.Stub {

}

I have done this with Android Official documentation . 我已经使用Android官方文档完成了此操作。 And found the root cause of my problem.I the above posted code there is another aidl interface being used in my case. 并找到了问题的根本原因。在上面发布的代码中,我的案例中使用了另一个aidl接口。 IControllerInterface is not able to find IControllerCallback interface. IControllerInterface无法找到IControllerCallback接口。 Please let me know how to access one aidlinterface into another aidl interface. 请让我知道如何将一个辅助接口访问另一个辅助接口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM