第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

json解析天氣顯示到Listview中

json解析天氣顯示到Listview中

W遇見S 2016-12-13 19:30:32
用接口拿到的,望大神幫下忙,都弄好幾天了,顯示出來的listview顯示的都是同一天的
查看完整描述

1 回答

已采納
?
alionSSS

TA貢獻(xiàn)57條經(jīng)驗 獲得超82個贊

//Json格式有個小錯誤
"today":{

??????"temperature":"14℃~15℃",
??????"weather":"中雨轉(zhuǎn)陰",
??????"weather_id":{
????????"fa":"08","fb":"02"
??????},//此處你用的分號(;),應(yīng)該用逗號(,)


查看完整回答
1 反對 回復(fù) 2016-12-13
  • W遇見S
    W遇見S
    private List<WeatherBean> list=new ArrayList<>(); private void parseJSONWithJSONObject(String jsonData) { try { JSONObject jsonObject = new JSONObject(jsonData); JSONObject result = jsonObject.getJSONObject("result"); JSONArray jsonArrayWeather=result.getJSONArray("future"); for(int i=0;i<jsonArrayWeather.length();i++) { JSONObject Object =(JSONObject) jsonArrayWeather.get(i); String temperature = Object.getString("temperature"); String weather = Object.getString("weather"); String wind = Object.getString("wind"); String week = Object.getString("week"); String date = Object.getString("date"); WeatherBean weatherBean=new WeatherBean(temperature,weather,wind,week,date); list.add(weatherBean); } } catch (Exception e) { e.printStackTrace(); } } 我這樣解析數(shù)組并且想顯示到listview中為什么一直不能成功,listview中都是空白的
  • alionSSS
    alionSSS
    因為你拿到的JSON數(shù)據(jù)里面全是對象JSONObject,而你用了JSONArray。要怪只能怪服務(wù)端的人技術(shù)有問題。 【你問我如何判斷的?】---->只要是{},就是JSONObject;只要是[],就是JSONArray。 【題外話】--->有的服務(wù)端程序員甚至用數(shù)字“0”、漢字“一”這種來做標(biāo)識符,實在是***。因為“0”不能用來命名,所以這種情況需要建一個類加上注解@SerializedName("0")
  • 1 回答
  • 0 關(guān)注
  • 1775 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號