0

*JsonObject json为空,但导致onCompleted函数工作正常并正确返回 json 数据,但我不能在oncompleted函数之外使用它*

   final JsonObject json = new JsonObject();
            Ion.with(MainActivity.this)
                    .load("https://wordsapiv1.p.mashape.com/words/" + searchedWord)
                    .setHeader("X-Mashape-Key","I've hidden the Key !")
                    .asJsonObject()
                    .setCallback(new FutureCallback<JsonObject>() {
                        @Override
                        public void onCompleted(Exception e, JsonObject result) {
                            Log.i("result: ","" + result);
                            Log.i("json: ", "" + json);
                        }
                    });
4

1 回答 1

-1

我不明白你为什么需要第一行?

final JsonObject json = new JsonObject();
于 2018-01-13T15:36:50.733 回答