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

正文內(nèi)容

基于android平臺(tái)的天氣軟件開(kāi)發(fā)畢業(yè)論文-閱讀頁(yè)

2025-01-31 13:00本頁(yè)面
  

【正文】 */ public String getCityCode(String city) { Database_Helper dbHelper = new Database_Helper(_context, panda_weather)。 Cursor cursor = null。 } catch (UnsupportedEncodingException e) { ()。 while (()) { code = ((code))。 // 關(guān)閉數(shù)據(jù)庫(kù) return code。 SQLiteDatabase db = ()。 try { cursor = (city, new String[] { _id, code }, _id=?, new String[] { 1 }, null, null, null)。 } String city = 。 (query + city)。 ()。 // 給默認(rèn)數(shù)據(jù)庫(kù)賦值 return city。 SQLiteDatabase db = ()。 (code, code)。 // 更新默認(rèn)城市 ()。在對(duì)數(shù)據(jù)庫(kù)進(jìn)行操作前,同前面創(chuàng)建數(shù)據(jù)庫(kù)時(shí)講到的一樣,需要獲得一個(gè) SQLiteOpenHelper 對(duì)象,然后才能進(jìn)行操作,這里不再描述。init 函數(shù)執(zhí)行的數(shù)據(jù)庫(kù)的初始化工作,軟件在加載的時(shí)候檢查數(shù)據(jù)庫(kù)是否存在,如果不存在,就將數(shù)據(jù)庫(kù)文件拷貝到指定的目錄,如果檢測(cè)到存在,則直接返回。搜索時(shí),由輸入的城市名,搜索對(duì)應(yīng)的城市碼,然后將結(jié)果返回,如果沒(méi)有搜索到,則提示城市不存在。這樣,對(duì)數(shù)據(jù)庫(kù)方面的編程就完成了。頁(yè)面的內(nèi)容很簡(jiǎn)單,在頁(yè)面中共設(shè)置了3個(gè)TextView,分別顯示學(xué)校中文全稱,英文簡(jiǎn)稱和版權(quán)信息,顯示內(nèi)容在 文件中進(jìn)行了聲明,這里使用的時(shí)候直接引用。所以,在界面中的控件從上到下依次顯示。, ,代碼為: setContentView()。數(shù)據(jù)庫(kù)的初始化: // 初始化,轉(zhuǎn)移數(shù)據(jù)庫(kù)文件 ()。這里為設(shè)置了一個(gè)定時(shí)器,在加載界面顯示800毫秒之后開(kāi)始數(shù)據(jù)的下載,具體的操作放在一個(gè)任務(wù)里面,在定時(shí)器到了之后開(kāi)始執(zhí)行任務(wù)。 (code, ())。 while(true){ if(() != 0){ (0)。 } } } }。 if(() == ){ (, 連接超時(shí)!請(qǐng)檢查網(wǎng)絡(luò)連接!, ).show()。 Intent weatherIntent = new Intent()。 (weatherIntent)。 // 界面的切換 ()。對(duì)于下載的過(guò)程與數(shù)據(jù)的解析,將在后面的內(nèi)容中介紹。這些就是有關(guān)加載界面的內(nèi)容,接下來(lái)將進(jìn)入到下一個(gè)界面,實(shí)時(shí)天氣界面。根據(jù)前面對(duì)實(shí)時(shí)天氣界面的設(shè)計(jì),在布局文件中將整個(gè)界面分為上下兩個(gè)部分,中間以一條線作為分界。當(dāng)界面顯示的是默認(rèn)城市的天氣信息的時(shí)候,會(huì)使用一個(gè)TextView提示顯示的是默認(rèn)城市,這時(shí)候設(shè)置默認(rèn)的按鈕就會(huì)隱藏;當(dāng)界面顯示的不是默認(rèn)的城市,而是選擇查看的另外一個(gè)城市的信息的話,就會(huì)顯示設(shè)置默認(rèn)按鈕,這時(shí)候提示默認(rèn)就會(huì)隱藏。 }else if ((())) { ()。 } else { ()。 }在界面的中間部分使用了一個(gè) TextView 將上下兩個(gè)部分隔開(kāi)了,顯示效果為一條水平線。 文件,但僅僅這樣引用還不夠, 文件中再一次聲明所有控件,并將它們與 中對(duì)應(yīng)的控件綁定在一起,這樣才能夠?qū)λ鼈冞M(jìn)行操作。 city = (TextView) findViewById()。正確獲取城市的天氣信息后,就開(kāi)始布局界面,給界面中的控件賦值: /** * 給界面中的各個(gè)控件賦值 */ private void beginSet() { // 給控件賦值 (img, ()[0], this)。 (()[0])。 (())。 (())。 (溫馨提示: + ())。跳轉(zhuǎn)到未來(lái)天氣的操作,還有當(dāng)前城市不是默認(rèn)的時(shí)候設(shè)置為默認(rèn)的操作,均設(shè)置為按鈕的監(jiān)聽(tīng)事件,當(dāng)點(diǎn)擊按鈕,執(zhí)行監(jiān)聽(tīng)器里的操作。代碼如下: /** * 跳轉(zhuǎn)到未來(lái)天氣 頁(yè)面 */ class turnFeatureListener implements OnClickListener { public void onClick(View v) { if (weatherEntity == null | () == null) { return。 (weatherEntity, weatherEntity)。 startActivity(intent)。 // 設(shè)置數(shù)據(jù)庫(kù)中的默認(rèn)城市 = 1。 ()。點(diǎn)擊menu按鈕,彈出菜單,即可選擇。代碼如下: /** * 菜單設(shè)置 */ public boolean onCreateOptionsMenu(Menu menu) { // TODO Autogenerated method stub (0, SEARCH, 1, )。 return (menu)。 (, )。 } else if (() == EXIT) { finish()。 }以上就是實(shí)時(shí)天氣界面的實(shí)現(xiàn)。需要注意的是,當(dāng)用戶要點(diǎn)擊未來(lái)天氣按鈕的時(shí)候,表示已經(jīng)看到一個(gè)城市的天氣情況,這個(gè)城市可是默認(rèn)的,也可能是用戶選擇得到的,但無(wú)論是哪種情況,都表示已經(jīng)存在了一個(gè)天氣實(shí)體對(duì)象。下面來(lái)介紹未來(lái)天氣界面。這個(gè)界面比較簡(jiǎn)單,但是用了很多控件去顯示天氣信息,主要內(nèi)容包括:城市名、每天是星期幾、每天的天氣描述圖片、還有每天的溫度范圍,對(duì)于當(dāng)天的天氣情況,還給出了文字描述,而且字符的大小設(shè)置上也比其他的大一些,以達(dá)到突出顯示的效果。因?yàn)樵O(shè)置的過(guò)程是類似的,所以這里以第一天的數(shù)據(jù)顯示為例來(lái)介紹,: ! 第一天的天氣 LinearLayout android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=horizontal android:paddingTop=5dp TextView android:id=+id/t1 android:layout_width=92dp android:layout_height=fill_parent android:paddingTop=5dp android:textSize=10pt/ ImageView android:id=+id/v1 android:layout_width=60dp android:layout_height=60dp android:visibility=visible android:contentDescription=string/con/ TextView android:id=+id/s1 android:paddingTop=5dp android:layout_width=wrap_content android:layout_height=fill_parent android:layout_marginLeft=20dp android:textSize=10pt/ /LinearLayout: TextView t1 = null。 TextView s1 = null。 v1 = (ImageView)findViewById()。 (())。 (()[0])。這些就是未來(lái)天氣界面的內(nèi)容。用戶點(diǎn)擊實(shí)時(shí)天氣界面菜單項(xiàng)中的選擇城市選項(xiàng)后,跳轉(zhuǎn)到這個(gè)界面。輸入框和確認(rèn)按鈕在同一行顯示,在輸入框內(nèi)設(shè)置了輸入框內(nèi)的提示信息,代碼如下: LinearLayout android:layout_width=fill_parent android:layout_height=wrap_content android:layout_marginTop=20dp android:orientation=horizontal EditText android:id=+id/searchEdit android:layout_width=wrap_content android:layout_height=fill_parent android:layout_weight=6 android:inputType=text android:hint=string/defaultTishi/ Button android:id=+id/searchButton android:layout_width=wrap_content android:layout_height=fill_parent android:text=string/searchButton android:textSize=10pt android:textStyle=bold android:layout_weight=2/ /LinearLayout搜索到的結(jié)果顯示效果為一個(gè)按鈕,搜索到的城市名顯示在這個(gè)按鈕上,點(diǎn)擊這個(gè)按鈕界面將切換到實(shí)時(shí)天氣界面并顯示這個(gè)城市的天氣情況。 Database_Tools db_tools = new Database_Tools()。 if (code != ) { (city)。 } else { (, 提示:沒(méi)有此地名, 請(qǐng)正確輸入!, ).show()。 return。 intent = new Intent(, )。 // 倒計(jì)時(shí)下個(gè)任務(wù) (task, 500)。 版權(quán)信息及Logo設(shè)計(jì)在每個(gè)界面的正下方都添加了版權(quán)信息,在布局文件中的代碼如下: LinearLayout android:orientation=vertical android:layout_width=fill_parent android:layout_height=wrap_content android:layout_marginTop=100dp TextView android:text=string/ab android:layout_width=fill_parent android:layout_height=wrap_content android:gravity=center_horizontal/ /LinearLayout引用的字符串對(duì)應(yīng)為: string name=ab 169。在圖片的邊緣,使用木紅色畫(huà)了一個(gè)圓角矩形,四個(gè)角設(shè)置成灰色,以搭配應(yīng)用程序界面。 數(shù)據(jù)處理 天氣實(shí)體類程序在下載和解析數(shù)據(jù)的時(shí)候是以一個(gè)天氣實(shí)體類對(duì)象進(jìn)行的,將下載到的數(shù)據(jù)看成是一個(gè)實(shí)體類的對(duì)象,然后將數(shù)據(jù)放在這個(gè)對(duì)象中,這樣就得到了一個(gè)城市的天氣數(shù)據(jù)。 // 城市名 city private String cityid。 // 風(fēng)速 wind1 private String date。 // 星期week private String[] weather = new String[6]。 // 高低溫度temp16 private String[] img_title = new String[6]。 // 發(fā)布時(shí)間inch private String advice。在創(chuàng)建類的時(shí)候,需要用到無(wú)參數(shù)的構(gòu)造函數(shù)和有參數(shù)的構(gòu)造函數(shù),代碼描述如下: public Weather_Entity() { super()。 = cityid。 = date。 = weather。 = img_title。 = advice。程序中界面的顯示都是以天氣實(shí)體類的對(duì)象進(jìn)行的,下載并生成天氣實(shí)體類對(duì)象后對(duì)界面中的控件賦值,然后界面才能正常顯示。首先,聲明一個(gè)URL對(duì)象,打開(kāi)鏈接 + code + .html ,其中,code為一個(gè)城市的城市碼,打開(kāi)鏈接后讀入文本內(nèi)容,然后以字符串形式返回,過(guò)程如下: /** *
點(diǎn)擊復(fù)制文檔內(nèi)容
試題試卷相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1