How to Android koush/ion get data?

  • Replies:5
camillelola
  • Forum posts: 2

Aug 8, 2018, 11:22:39 AM via Website

I am working as an Android developer. I am facing an issue is I can't access the results inside the onCompleted method, I want to get the data from an onCompleted method and send to my view.

 public double walletApiCall(final Activity myactivity, final String addresses) {
    double unCon_balance;
    Ion.with(myactivity)
           .load(URL)
            .asString()
            .setCallback(new FutureCallback<String>() {
                @Override
                public void onCompleted(Exception e, String result) {

                    JSONObject tomJsonObject = null;

                    try {
                        tomJsonObject = new JSONObject(result);
                    } catch (JSONException e1) {
                        e1.printStackTrace();
                    }

                    walletApiCall(result,myactivity);
                    System.out.println("unCon_balance2: "+ unCon_balance);
                }
            });

    return unCon_balance;

}

Thanks & Regards
Camillelola
Mindmajix.com

Reply
James Watson
  • Forum posts: 1,584

Aug 8, 2018, 3:51:36 PM via Website

Sorry that I am not clear about Ion and Itscallback method. But it seems that there are at least two potential questions:
1. does not set value to unCon_balance
2. does not return tomJsonObject

Do you think so?

Download size < 0.15 MB. But also accurate enough, ad-free & free.
The minimalist app available on Play Store: https://goo.gl/ws42fN
Blog: https://okblackcafe.blogspot.com Your 5-star is appreciated.

Helpful?
Reply
camillelola
  • Forum posts: 2

Aug 9, 2018, 6:21:38 AM via Website

Hi James,

Thanks for your reply. I don't know what exactly... so, that's why I am asking

Helpful?
Spatanuss882
Reply
onepeople
  • Forum posts: 11

Aug 13, 2018, 4:52:38 AM via Website

Sure . i think so that .

Helpful?
Reply
Tushaar Kamat
  • Forum posts: 12

Aug 14, 2018, 2:02:58 AM via Website

Thanks

Helpful?
Reply
Spatanuss882
  • Forum posts: 11

Nov 6, 2019, 5:10:30 PM via Website

thank for sharring !

Helpful?
Reply