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

正文內(nèi)容

畢業(yè)設(shè)計(jì)---基于android平臺(tái)的3g氣象軟件-畢業(yè)設(shè)計(jì)-閱讀頁(yè)

2025-02-08 04:50本頁(yè)面
  

【正文】 FORECASTS_ID: { String forecastId = ().get(1)。 ( + = + forecastId)。 } } return (db, projection, selection, selectionArgs, null, null,sortOrder, limit)。 添加功能: public Uri insert(Uri uri, ContentValues values) {} 刪除功能: public int delete(Uri uri, String selection, String[] selectionArgs) {} 更新功能: public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {} (5) 類型匹配 :增刪改查通過(guò) switch 判斷,進(jìn)行不同的操作,因而還需 要對(duì)關(guān)鍵字進(jìn)行類型匹配。 case WIDGETS_ID: return 。 case FORECASTS: return 。 } throw new IllegalStateException()。 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)。 } } 后臺(tái)服務(wù) 后臺(tái)服務(wù)是 tyweather工程的核心模塊 ,在用戶啟動(dòng)后持續(xù)在后臺(tái)運(yùn)行,直到用戶停止服務(wù)。 獲取天氣數(shù)據(jù) 天氣數(shù)據(jù) 的獲取天氣數(shù)據(jù)分為以下三個(gè)步驟: (1) 從 Google提供的 Web Service中獲取的天氣數(shù)據(jù),數(shù)據(jù)的獲取地址是: 下: public static WidgetEntity queryWebservice(String postalCode) throws ForecastParseException { //編碼出錯(cuò) if (postalCode == null) { throw new ForecastParseException(can not covert to entity)。 WidgetEntity widgetEntity = null。 //創(chuàng)建 Http Get請(qǐng)求 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來(lái)創(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ù) 存儲(chǔ)到 SQLite 數(shù)據(jù)庫(kù)中 。核心代碼如下, 調(diào)用關(guān)系如圖 。 (forecastUri, null, null)。 for (ForecastEntity forecast : ()) { ()。 ...... (forecastUri, values)。 讀取天氣數(shù)據(jù) 實(shí)例 通過(guò) ()方法 操作數(shù)據(jù)庫(kù)取出所需要的數(shù)據(jù),這一部分與 上一節(jié)的 “ 將解析好的 數(shù)據(jù)存儲(chǔ)到 SQLite數(shù)據(jù)庫(kù)中”的關(guān)鍵點(diǎn)相同, 為節(jié)約篇幅, 此處不贅述。 AppWidget一啟動(dòng)就會(huì)啟動(dòng) ForcastTimeService這個(gè)后臺(tái)服務(wù),此服務(wù)設(shè)置了每隔 20秒刷新一次時(shí)間, “顯示頁(yè)面”通過(guò)這個(gè)后臺(tái)服務(wù)獲取系統(tǒng)時(shí)間從而顯示。 (, now + updateMilis, pendingIntent)。 service android:name=ForecastService/service service android:name=ForecastTimeService/service 用戶界面 在用戶界面設(shè)計(jì)上,采用了 AppWidget框架結(jié)構(gòu),提供直觀的交互操作。 程序入口類 ForecastWidget ForecastWidget在設(shè)計(jì)上采用了 AppWidget框架結(jié)構(gòu), AppWidget就是HomeScreen上顯示的小部件,通過(guò)在 HomeScreen空白處長(zhǎng)按,在彈出的對(duì)話框第五章 程序開發(fā) 中選擇 Widget部件來(lái)進(jìn)行創(chuàng)建。創(chuàng)建 AppWidget需要以下四個(gè)步驟: (1) 定義 Widget布局文件,此文件是 res/layout/,采用AbsoluteLayout方式進(jìn)行布 局 需要注意的是在這個(gè)文件中所使用的組件必須是 RemoteViews所支持的。代碼如下: ?xml version= encoding=utf8? appwidgetprovider xmlns:android= android:initialLayout=layout/weather //Widget的布局文件 //在啟動(dòng)前首先要啟動(dòng) ConfigureActivity進(jìn)行設(shè)置 android:configure= android:minWidth=292dip //定義 Widget組件的寬度 android:minHeight=144dip //定義 Widget組件的高度 android:updatePeriodMillis=0 //更新的時(shí)間周期 /appwidgetprovider (3) 創(chuàng)建 ,此類繼承自 AppWidgetProvider,主要的功能有:獲取需要更新的桌面小控件;啟動(dòng)獲取天氣預(yù)報(bào)信息的服務(wù);啟動(dòng)時(shí)間信息的服務(wù); 更新 桌面小控件顯示內(nèi)容 ;更新時(shí)間信息 。 // 獲取需要更新的桌面小控件 (appWidgetIds)。 // 啟動(dòng)時(shí)間信息的服務(wù) (new Intent(context, ))。代碼如下: 第五章 程序開發(fā) !receiver字段定義的是 AppWidgetProvider類 — receiver android:icon=drawable/weather android:label=string/app_name android:name=ForecastWidget !intentfilter說(shuō)明 appWidget可以接受下面的廣播事件 — intentfilter action android:name= /action /intentfilter !metadata指明 屬性 文件 — metadata android:name= android:resource=xml/weatherwidget/metadata /receiver 設(shè)置頁(yè)面 ConfigureActivity ConfigureActivity繼承 Activity并且實(shí)現(xiàn)了 ,AppWidget第一次啟動(dòng)之前會(huì)先運(yùn)行 ConfigureActivity,會(huì) 出現(xiàn)設(shè)置頁(yè)面用戶進(jìn)行設(shè)置, 點(diǎn)擊保存按鈕就會(huì)將 設(shè)置好的參數(shù)會(huì)存儲(chǔ)到 SQLite中 。 updatetime = (().toString())。 (, widgetId)。 (, updatetime)。 (, 1)。 // 通過(guò) ContentResolver對(duì)象 存儲(chǔ)數(shù)據(jù) (, values)。 // 啟動(dòng) 獲取天氣預(yù)報(bào)信息的 后臺(tái)服務(wù) startService(new Intent(this, ))。 finish()。 } } ConfigureActivity的布局文件是 res/layout/,采用了LinearLayout的布局方式。為了能夠以列表的形勢(shì)顯示多行數(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),訪問(wèn)數(shù)據(jù)庫(kù) 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。)。 動(dòng)態(tài)特效 動(dòng)態(tài)特效是指如果天氣為多云或雨天時(shí),就會(huì)在 云或下落的 雨 滴 ;如果天氣為 晴 時(shí),就會(huì)在 透明度逐漸變化第五章 程序開發(fā) 的太陽(yáng)圖標(biāo)等 。 動(dòng)畫效果是通過(guò) XML文件來(lái)實(shí)現(xiàn)的。代碼如下所示: !—“ 下落雨滴”動(dòng)態(tài)效果 — ?xml version= encoding=utf8? set xmlns:android= !—Y不變, X從 100到 420,重復(fù)無(wú)限次 — translate android:repeatCount=1 android:fromXDelta=100 android:toXDelta=420 android:fromYDelta=50 android:toYDelta=50 android:duration=15000 / /set 第 六 章 系統(tǒng)測(cè)試 第六章 系統(tǒng)測(cè)試 至此已經(jīng)完成了 tyweather工程的代碼編寫工作,在這一章節(jié)對(duì) tyweather工程進(jìn)行測(cè)試,步驟及結(jié)果如下: (1) 啟動(dòng) Android虛擬機(jī) 在工程名 tyweather上點(diǎn)右鍵,然后 選擇“ Run As”,然后選擇“ Android Application”。 如下圖所示: (2) 啟動(dòng) App Widget應(yīng)用程序 長(zhǎng)按屏幕空白處,選擇“ Widget”,然后選擇“天氣預(yù)報(bào)” 。 如下圖所示: (3)設(shè)置好后就進(jìn)入顯示頁(yè)面,顯示頁(yè)面通過(guò)文字和圖片顯示當(dāng)前的天氣情況,包括日期、時(shí)間、城市、最高溫度、最低溫度、當(dāng)前溫度等。 如下圖所示: (5) 長(zhǎng)按顯示頁(yè)面 并拖動(dòng)到垃圾箱,即可將程序刪除。由于對(duì) JAVA濃厚的興趣引發(fā)了我對(duì) Android 的好奇心,從一開始什么都不懂一直摸索著運(yùn)用了很多高級(jí)技術(shù)完成了這個(gè)軟件
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評(píng)公示相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1