How to convert an object into kotlin of type Any! to anyone else who can access the fields?

0

Good morning,

I'm having a rather annoying problem of being solved in a project. I'm trying to make an application that will communicate with odoo ERP, however, this ERP uses the xml-rpc protocol for their requests.

To make the requests I'm using the axml-rpc lib for android. It is a library made in java, but it seems to be working. When I call a remote function from odoo, lib returns me an Any object! with the answers, however, I can not access the information.

Is it possible to access this HashMap within the name variable or does this blue color indicate a problem? Thank you!

Ps: I've tried several casts, but none worked.

    
asked by anonymous 24.01.2018 / 13:30

1 answer

1

I would recommend you to understand what the library does in Java ( reading the documentation ), what are the types with which it works, then transposes to Kotlin.

According to the documentation, you are getting a array (which is represented in the library as Object[] in Java). Within this array , based on print, there is struct (represented in the library by Map<String,Object> )

Translating this initial structure, you would have in Kotlin:

  • A Array<Any> - Equivalent to Object[]
  • Within the array, a Map<String, Any>
02.02.2018 / 14:21