0
我很困惑,請你能幫助我嗎?我讀過類似的問題,但對我來說並不清楚,因爲要提前感謝您的耐心和關注。如何從改造我的方法返回數據我很困惑?
我想返回到使用Retrofit從API調用中檢索到的onCreate數據。這裏是我調用Retrofit的功能。
私人無效loadTimeZoneAPI(雙緯度,經度兩倍,長時間戳,字符串apiKeyTz){
String lat = Double.toString(latitude);
String lon = Double.toString(longitude);
String time = Long.toString(timestamp);
serviceTZ.getDataTZ(lat+","+lon, time, apiKeyTz).enqueue(new Callback<TimeZoneGoogle>() {
@Override
public void onResponse(Call<TimeZoneGoogle> call, Response<TimeZoneGoogle> response) {
TimeZoneGoogle result = response.body();
timeZone = result.getTimeZoneId();
}
@Override
public void onFailure(Call<TimeZoneGoogle> call, Throwable t) {
}
});
}
如何,我將返回區值,以在OnCreate在那裏我將用於計算。
分享您的課堂,你想返回你有數據從服務器的數據和類 –
@vikaskumar這是我的班級我的班級https://gist.github.com/ArnalShoorukov/8776041 dc998bafc1d9c8370f6a3760c –