0

I've been working with ion library and I've stored the value returned ( as a string ) in the future variable, but I don't know how to show the results or retrieve it. Here's my code.

 public Future<String> getCars(){

   future =
            Ion.with(this)
           .load("http://localhost:3000/api/cars")
           .asString()
           .setCallback(new FutureCallback<String>() {
               @Override
               public void onCompleted(Exception e, String result) {


               }
           });

   return future;

}

How to handle the variable I'm returning? Is my usage correct in the first place? I would like to know if I'm on the right track, and if I'm, I would like to know how to get json data as a string and show it in a TextView.

Thank you.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Red John
  • 105
  • 3
  • 11

1 Answers1

0

This is correct. Your string is in the "result" variable. Just put it in the TextView using setText.

koush
  • 2,972
  • 28
  • 31