I want to return a string value from my function. But I do not know how to handle it? I tried final one-array solution but it did not work out.
Here is my code:
public String revealCourtPlace(String courtID)
{
BaseService.getInstance().getUniqueCourt(Session.getToken(),courtID).enqueue(new Callback<JsonObject>()
{
@Override
public void onResponse(Call<JsonObject> call, Response<JsonObject> response)
{
JsonObject object = response.body();
boolean success = object.get("success").getAsBoolean(); //json objesinde dönen success alanı true ise
if (success)
{
JsonArray resultArray = object.get("data").getAsJsonObject().get("result").getAsJsonArray();
for (int i = 0; i < resultArray.size(); i++)
{
JsonObject jsonInfoResult = resultArray.get(i).getAsJsonObject();
String courtName=jsonInfoResult.get("name").getAsString();
}
}
}
@Override
public void onFailure(Call<JsonObject> call, Throwable t)
{
}
});
//return ?
}