我的 AIDL 文件中有一个函数
int getAvailableTokens(out List<String> list);
从主类我想调用这个函数并作为参数给出List<String> mylist
命令函数将设置它。我怎么能做到这一点?
已编辑
int getAvailableTokens (List<FidoTokenInfo> list) throws RemoteException {
// EDITED: The list must be set in this way!!!
list.addAll(mFidoDsm.getList());
// THIS WAY IS NOT CORRECT !!!
// list = mFidoDsm.getList();
Log.i(TAG, "list .size() = " + list.size()); // here list size is 1.
}
// First this function calles.
public List<FidoTokenInfo> getAllTokens () throws FidoException {
List<String> tokenList = new ArrayList<String>();;
try {
int error = dsmService().getAvailableTokens(tokenList);
Log.i(TAG, "tokenList.size() = " + tokenList.size()); // here list size is 0.
return tokenList;
} catch (RemoteException e) {
}
}
好吧,我做了一些更改,这是我的代码,如您所见,我getAvailableTokens
从函数调用getAllTokens
函数并作为参数传递给getAvailableTokens
列表tokenList
,然后在getAvailableTokens
我设置该列表,然后我检查它的大小为 1,但是当我检查列表的大小时tokenList
它是 0 但为什么?