Detailed explanation of map parameter transfer in Android Aidl
preface
Aidl is an abbreviation and its full name is Android interface finalization language, that is, Android interface definition language.
We all know that Aidl supports map passing as a parameter, but the premise is that the map cannot be generic and the data type must be the map parameters of string, int, etc. supported by Aidl:
I thought it would be possible to proceed normally, but there will be errors. The following exceptions are thrown:
In the above error, it is first explained that you do not know how to create a map < K, V > container, but Aidl must support the transfer of map parameters. Finally, it is pointed out that this is an unknown type.
This is indeed a problem.
resolvent
I checked some information on the Internet and found that I rarely introduced this aspect. Finally, in constant attempts, it is found that the following writing can be solved:
Note that if there is no in modifier in front of the map, an exception will be thrown:
Therefore, when used, the map must be declared as in, out or inout. Then you can use it directly.
Because there are too few records of this problem on the Internet, I write to answer people who encounter this problem like me.
Note: as for why it is used in this way, it is not clear at present. Please give more advice.
summary
The above is the whole content of this article. I hope the content of this article has a certain reference value for your study or work. If you have any questions, you can leave a message. Thank you for your support for programming tips.