1

I have written an android app using Kotlin that consumes an API written in C#. The API method is supposed to return "true" (as a string and not a boolean), and it does. I am using Fuel to call the API.

Everything works fine but when I get the data i get the value as ""true"". Hence (data == "true") always returns false.

What could be going wrong?

Kotlin code :

                "abcdefgh"
                .httpPost()
                .body("$firstArg|$secondArg")
                .responseString() { request, response, result ->
                    when (result) {
                        is Result.Failure -> {
                            val ex = result.getException()
                            Toast.makeText(this, ex.message, Toast.LENGTH_LONG)
                                .show() 
                        }
                        
                        is Result.Success -> {
                            **val data = result.get()**
                           .
                           .
                           .
                           .
                           .

data is always ""true"" instead of expected "true".

Please help.

MethodToChaos
  • 335
  • 2
  • 17

0 Answers0