freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

本科畢業(yè)論文-基于android平臺的3g氣象軟件設(shè)計-閱讀頁

2025-06-23 08:22本頁面
  

【正文】 )。 private static final int WIDGETS = 101。 private static final int WIDGETS_FORECASTS = 103。 private static final int FORECASTS_ID = 202。 (AUTHORITY, widgets/, WIDGETS_ID)。 (AUTHORITY, forecasts, FORECASTS)。 } } 后臺服務(wù) 后臺服務(wù)是 tyweather工程的核心模塊,在用戶啟動后持續(xù)在后臺運(yùn)行,直到用戶停止服務(wù)。 獲取天氣數(shù)據(jù) 天氣數(shù)據(jù)的獲取天氣數(shù)據(jù)分為以下三個步驟: (1) 從 Google提供的 Web Service中獲取的天氣數(shù)據(jù),數(shù)據(jù)的獲取地址是: 下: public static WidgetEntity queryWebservice(String postalCode) throws ForecastParseException { //編碼出錯 if (postalCode == null) { throw new ForecastParseException(can not covert to entity)。 WidgetEntity widgetEntity = null。 //創(chuàng)建 Http Get請求 HttpGet request = new HttpGet((WEBSERVICE_URL, postalCode))。s weather infomation)。 第五章 程序開發(fā) StatusLine status = ()。 //取出回復(fù)信息 HttpEntity entity = ()。 } catch (IOException e) { throw new ForecastParseException(Problem calling forecast API, e)。 } return widgetEntity。核心代碼如下: //返回類型為 WidgetEntity private static WidgetEntity parseResponse(Reader responseReader) throws ForecastParseException { ...... try { //使用工廠類 XmlPullParserFactory來創(chuàng)建解析器 XmlPullParser XmlPullParserFactory factory = ()。 String tagName = null。 int eventType = ()。 //根據(jù)不同的標(biāo)簽做不同的解析 if ((tagName)) { throw new ForecastParseException( the city is non correct!)。 } else if ((tagName)) { dealWithCurrentConditions(tagName, widgetEntity, xpp)。 } } eventType = ()。 } (3) 將 解 析 好 的 數(shù) 據(jù) 存 儲 到 SQLite 數(shù) 據(jù) 庫 中 。核心代碼如下,調(diào)用關(guān)系如圖 。 (forecastUri, null, null)。 for (ForecastEntity forecast : ()) { ()。 ...... (forecastUri, values)。 讀取天氣數(shù)據(jù)實(shí)例 通過 ()方法 操作數(shù)據(jù)庫取出所需要的數(shù)據(jù),這一部分與上一節(jié)的“ 將解析好的數(shù)據(jù)存儲到 SQLite數(shù)據(jù)庫中”的關(guān)鍵點(diǎn)相同,為節(jié)約篇幅,此處不贅 述。 AppWidget一啟動就會啟動 ForcastTimeService這個后臺服務(wù),此服務(wù)設(shè)置了每隔 20秒刷新一次時間,“顯示頁面”通過這個后臺服務(wù)獲取系統(tǒng)時間從而顯示。 (, now + updateMilis, pendingIntent)。 service android:name=ForecastService/service service android:name=ForecastTimeService/service 用戶界面 在用戶界面設(shè)計上,采用了 AppWidget框架結(jié)構(gòu),提供直觀的交互操作。 程序入口類 ForecastWidget ForecastWidget在設(shè)計上采用了 AppWidget框架結(jié)構(gòu), AppWidget就是HomeScreen上顯示的小部件,通過在 HomeScreen空白處長按,在彈出的對話框第五章 程序開發(fā) 中選擇 Widget部件來進(jìn)行創(chuàng)建。創(chuàng)建 AppWidget需要以下四個步驟: (1) 定義 Widget布局文件,此文件是 res/layout/,采用AbsoluteLayout方式進(jìn)行布局 需要注意的是在這個文件中所使用的組件必須是 RemoteViews所支持的。代碼如下: ?xml version= encoding=utf8? appwidgetprovider xmlns:android= android:initialLayout=layout/weather //Widget的布局文件 //在啟動前首先要啟動 ConfigureActivity進(jìn)行設(shè)置 android:configure= android:minWidth=292dip //定義 Widget組件的寬度 android:minHeight=144dip //定義 Widget組件的高度 android:updatePeriodMillis=0 //更新的時間周期 /appwidgetprovider (3) 創(chuàng)建 ,此類繼承自 AppWidgetProvider,主要的功能有:獲取需要更新的桌面小控件;啟動獲取天氣預(yù)報信息的服務(wù);啟動時間信息的服務(wù);更新桌面小控件顯示內(nèi)容;更新時間信息。 // 獲取需要更新的桌面小控件 (appWidgetIds)。 // 啟動時間信息的服務(wù) (new Intent(context, ))。代碼如下: 第五章 程序開發(fā) !receiver字段定義的是 AppWidgetProvider類 — receiver android:icon=drawable/weather android:label=string/app_name android:name=ForecastWidget !intentfilter說明 appWidget可以接受下面的廣播事件 — intentfilter action android:name= /action /intentfilter !metadata指明屬性文件 — metadata android:name= android:resource=xml/weatherwidget/metadata /receiver 設(shè)置 頁面 ConfigureActivity ConfigureActivity繼承 Activity并且實(shí)現(xiàn)了 ,AppWidget第一次啟動之前會先運(yùn)行 ConfigureActivity,會出現(xiàn)設(shè)置頁面用戶進(jìn)行設(shè)置,點(diǎn)擊保存按鈕就會將設(shè)置好的參數(shù)會存儲到 SQLite中 。 updatetime = (().toString())。 (, widgetId)。 (, updatetime)。 (, 1)。 // 通過 ContentResolver對象存儲數(shù)據(jù) (, values)。 // 啟動 獲取天氣預(yù)報信息的 后臺服務(wù) startService(new Intent(this, ))。 finish()。 } } ConfigureActivity的布局文件是 res/layout/,采用了LinearLayout的布局方式。為了能夠以列表的形勢顯示多行數(shù)據(jù),并制定每行數(shù)據(jù)的布局,使用了 ListActivity。在此工程中,仍然使用 setContentView( )設(shè)置布局,這樣做的好處是可以在界面中設(shè)置更為復(fù)雜的顯示元素。 第五章 程序開發(fā) /** Called when the activity is first created. */ Override public void onCreate(Bundle savedInstanceState) { (savedInstanceState)。 ...... //獲取游標(biāo),訪問數(shù)據(jù)庫 Cursor forecastCursor = managedQuery(forecastUri, , null, null, null)。 } 列表適配器代碼: private class ForecastAdapter extends ResourceCursorAdapter { public ForecastAdapter(Context context, Cursor c) { //設(shè)置布局文件 super(context, , c)。 TextView day = (TextView) ()。 TextView temp = (TextView) ()。 ((1))。 ((2) + 161。/ + (3) + 161。)。 動態(tài)特效 動態(tài)特效是指如果天氣為多云或雨天時,就會在 云或下落的雨滴;如果天氣為晴時,就會 在 第五章 程序開發(fā) 的太陽圖標(biāo)等。動畫效果是通過 XML文件來實(shí)現(xiàn)的。代碼如下所示: !—“ 下落雨滴”動態(tài)效果 — ?xml version= encoding=utf8? set xmlns:android= !—Y不變, X從 100到 420,重復(fù)無限次 — translate android:repeatCount=1 android:fromXDelta=100 android:toXDelta=420 android:fromYDelta=50 android:toYDelta=50 android:duration=15000 / /set 第六章 系統(tǒng)測試 第六 章 系統(tǒng)測試 至此已經(jīng)完成了 tyweather工程的代碼編寫工作,在這一章節(jié)對 tyweather工程進(jìn)行測試,步驟及結(jié)果如下: (1) 啟動 Android虛擬機(jī) 在工程名 tyweather上點(diǎn)右鍵,然后選擇“ Run As”,然后選擇“ Android Application”。如下圖所示: (2) 啟動 App Widget應(yīng)用程序 長按屏幕空白處,選擇“ Widget”,然后選擇“天氣預(yù)報”。 如 下圖所示: (3)設(shè)置好后就進(jìn)入顯示頁面,顯示頁面通過文字和圖片顯示當(dāng)前的天氣情況,包括日期、時間、城市、最高溫度、最低溫度、當(dāng)前溫度等。 如下圖所示: (5) 長按顯示頁面并 拖動到垃圾箱,即可將程序刪除。由于對 JAVA濃厚的興趣引發(fā)了我對 Android 的好奇心,從一開始什么都不懂一直摸索著運(yùn)用了很多高級技術(shù)完成了這個軟件。 雖然,這個軟件目前 運(yùn)行良好,但是我認(rèn)為代碼的健壯行還很差,在整個工程的構(gòu)思方面也不足,用戶操作界面還不夠靈活,這些問題還需要今后逐一解決。 參考文獻(xiàn) 參考文獻(xiàn) [1] 靳巖,姚尚朗 . Google Android 開發(fā)入門與實(shí)戰(zhàn) .人民郵電出版社 [2] 景保玉 .2021中國移動應(yīng)用開發(fā)現(xiàn)狀與趨勢大調(diào)查, 2021年 01月 12日 [3] Michael . 輕松搞定 XML 林嘉勝譯 2021年 01月 08日 [4](英) Herbert Schildt Java 參考大全( J2SE 5 Edition), 清華大學(xué)出版社 [5](美) 鮑格斯坦 ( Bergsten, H.)著, 林琪 , 朱濤江 譯 .JSP 設(shè)計(第三版) / O’ Reilly Java 系列 [M].北京:中國電力出版社, 2021 年 12 月 . [6] 王向輝,張國印,沈 潔 .Android 應(yīng)用程序開發(fā) .清華大學(xué)出版社, 2021 年 3月 致謝 致 謝 本課題的設(shè)計和論文撰寫過程中,我的指導(dǎo)老師高輝、程浩老師給于了極大的幫助,為我提供了大量的相關(guān)資料
點(diǎn)擊復(fù)制文檔內(nèi)容
畢業(yè)設(shè)計相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1