我需要在Android服务和客户端之间传输字节数组.我试图定义一个aidl接口,如:
interface IMyService {
int putBytes(String key, in List<Byte> bytes);
int getBytes(String key, out List<Byte> bytes);
}
Run Code Online (Sandbox Code Playgroud)
但是,它没有编译.错误是:
[aidl] E:\workspace\RAMService\src\com\connexis\service\mem\IRAMService.aid
l:14 parameter bytes (2) unknown type List<Byte>
Run Code Online (Sandbox Code Playgroud)
有人能帮助我吗?提前致谢!
小智 8
尝试使用byte []而不是List,它适用于我.
interface IMyService {
int putBytes(String key, in byte[] bytes);
int getBytes(String key, out byte[] bytes);
}
Run Code Online (Sandbox Code Playgroud)
AIDL仅支持基元,String,CharSequence,List,Map.您可以拥有List但不能列出
尝试类似此处描述的操作:Transfering ByteArray through Parcel returns NullPointerException
这是如何通过将字节数组包装在 Parcelable 接口中来传输字节数组的示例。我认为你可以对 List 做同样的事情
| 归档时间: |
|
| 查看次数: |
5236 次 |
| 最近记录: |