天氣預報模組的實現

2021-07-25 11:24:34 字數 1836 閱讀 9901

一、執行效果圖

二、核心**

1.weatheradapter的**:

public class weatheradapter extends arrayadapter

public view getview(int position,view convertview,viewgroup viewgroup)else

viewholder.tvdayodweek.settext(weather.getdayofweek());

viewholder.tvdate.settext(weather.getdate());

viewholder.tvtemperature.settext(weather.gettemperature());

viewholder.tvweather.settext(weather.getweather());

return convertview;

} private class viewholder

}

2.weatheractivity的核心**:

public class weatheractivity extends activity

public weather(string dayofweek,string date,string temperature,

string weather)

public string getdayofweek()

public void setdayofweek(string dayofweek)

public string getdate()

public void setdate(string date)

public string gettemperature()

public void settemperature(string temperature)

public string getweather()

public void setweather(string weather)

@override

public string tostring()

}

4.httputil的核心**:

}}5.httpcallbacklistener的**:

public inte***ce httpcallbacklistener
6.activity_weather_listitem的**:

8.activity_weather的核心**:

三、遇到的問題

1. 在輸入位址之後不能顯示出天氣,經過檢查之後是申請的key出現了問題,重新申請之後就可以顯示了

2.在書上的酷歐天氣的例子時,由於沒有匯入google的jar包,程式出錯

Windows Mobile 天氣預報實現

最近在做個專案,其中用到天氣預報模組,如果自己在後台每天更新天氣資訊,必然存在更新不即時 花費大量人力等問題,因而,我採用yahoo提供的天氣服務,通過解析yahoo的rss資料,顯示在ppc上,然而,如果在windows mobile上接卸rss資料,對ppc的cpu是個很大的考驗,因而,我設計通...

Flex 天氣預報

效果如下截圖 建立乙個flex專案weather 在weather.mxml中新增乙個httpwebservice如下 result onresult event resultformat e4x 定義乙個onresult函式如下 bindable private var xml xml new x...

python天氣預報

1.引入requests import requests def query now 查詢實時天氣 return none query city input 請輸入要查詢的城市名稱 2.準備url位址 url query city 3.發請求,接收資料 response requests.get u...