이것은 제 J-SON 구문 분석으로 어디에서 실수하는지 이해하지 못합니다. 사람은 누구나 코드를보고 내가 틀렸다는 또한 J-SON의 URL내 JSON을보고 내 데이터가 UI에 표시되지 않습니다.
private Weather extractFeatureFromJSON (String json_incoming){
Weather sendInformation = null ;
try {
JSONArray jsonArray = new JSONArray(json_incoming);
JSONObject jsonObject = jsonArray.getJSONObject(0);
long timeReceived = jsonObject.getLong("EpochTime");
String weatherStatusReceived = jsonObject.getString("WeatherText");
boolean DayOrNightReceived = jsonObject.getBoolean("IsDayTime");
JSONObject fetchTemperature = new JSONObject("Temperature");
JSONObject dive_deep_t = fetchTemperature.getJSONObject("Metric");
double tempReceived = dive_deep_t.getDouble("Value");
JSONObject fetch_RF_Temperature = new JSONObject("RealFeelTemperature");
JSONObject dive_deep_t1 = fetch_RF_Temperature.getJSONObject("Metric");
double RF_tempReceived = dive_deep_t1.getDouble("Value");
JSONObject fetch_wind = new JSONObject("Wind");
JSONObject fetch_wind_direction = fetch_wind.getJSONObject("Direction");
int directionDegreeReceived = fetch_wind_direction.getInt("Degrees");
String in_which_direction = fetch_wind_direction.getString("Localized");
JSONObject fetch_wind_speed = fetch_wind.getJSONObject("Speed");
JSONObject fetch_wind_speed_in_metrics = fetch_wind_speed.getJSONObject("Metric");
double speedReceived = fetch_wind_speed_in_metrics.getDouble("Value");
int i = Integer.parseInt(in_which_direction);
int directionAndInWhich = directionDegreeReceived + i;
return new Weather(tempReceived , RF_tempReceived , DayOrNightReceived , weatherStatusReceived ,timeReceived , speedReceived , directionAndInWhich);
} catch (JSONException e) {
e.printStackTrace();
}
return null ;
}
당신은 어떤 오류가 않았다 새하지? – akhilesh0707
새 JSONObject ("온도")와 같은 새 JsonObjects를 만들고 싶습니까? 그리고 그들을 얻는 것이 아니라? – petul
런타임 오류 및 컴파일 오류가 없습니다. 가져 오는 데이터가 표시되지 않습니다! –