Can't get data in Android koush/ion

222 Views Asked by At

I want to get the data from onCompleted method and send to my view, but I cant access the results inside the onCompleted method.

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;
}
0

There are 0 best solutions below