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

正文內(nèi)容

計算機科學與技術(shù)專業(yè)精品畢業(yè)論文--基于android平臺的天氣軟件開發(fā)設(shè)計-全文預覽

2024-11-26 23:06 上一頁面

下一頁面
  

【正文】 yout_height=fill_parent android:orientation=vertical LinearLayout android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=horizontal TextView android:layout_width=fill_parent android:layout_height=wrap_content android:textSize=12pt android:textStyle=bold android:layout_marginTop=80dp android:gravity=center_horizontal android:text=string/siasU/ /LinearLayout TextView android:layout_width=fill_parent android:layout_height=wrap_content android:textSize=20pt android:textStyle=bold android:layout_marginTop=60dp android:gravity=center_horizontal android:text=string/sias/ 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 /LinearLayout 在整個界面中使用 LinearLayout 線性布局,方向為垂直方向。 這是程序的加載界面,所以,界面加載的時候要為應用程序做一些準備工作,包括前面提到的數(shù)據(jù)庫初始化工作,默認城市的天氣數(shù)據(jù)下載工作等。下載的過程放在一個 Service 里面,代碼如下: TimerTask task = new TimerTask(){ public void run() { intent = new Intent(, )。 break。 } if(() == ){ ()。 (, 29 )。當下載成功后,程序?qū)⑶袚Q到實時天氣頁面,當數(shù)據(jù)下載錯誤時,則提示檢查網(wǎng)絡(luò)連接。 在上部分中顯示的是城市天氣的詳細數(shù)據(jù),這里又將上部分分為左右兩列,在左邊顯示城市名、天氣描述、溫度、風速,在右邊顯示天氣圖片、日期、星期、發(fā)布時間和是否為默認城市,用到了 8 個 TextView:城市名、天氣描述、溫度、風速、日期、星期、發(fā)布時間、提示默認, 1 個 ImageView:天氣圖片、 1 個 Button:設(shè)置默認。 實時天氣界面 實時天氣界面 Weather_Activity,顯示的是一個城市的實時的詳細天氣信息,使用的布局文件時 。 } } }。 (, )。 下載過程執(zhí)行過后,判斷下載是否成功,然后關(guān)閉 Service ,跳轉(zhuǎn)到實時天氣頁面,代碼如下: Handler handler = new Handler(){ public void handleMessage(Message msg) { (intent)。 (intent)。 初始化數(shù)據(jù)庫之后,就要進行默認城市天氣數(shù)據(jù)的下載工作。設(shè)置的主要屬性為:居中顯示、控件之間間隔等。 用戶界面及操作 加載界面 加載界面 Load_Activity,程序開始運行的時候加載這個頁面,使用的布局文件是 。getCityCode 函數(shù)是在搜索時候用到的,操作的對象是 cities 表,也是在使用中用到的最多的函數(shù)。 } } 在代碼中給出了數(shù)據(jù)庫路徑 data/data/、數(shù)據(jù)庫名 panda_weather 和執(zhí)行具體操作的四個函數(shù)。 ContentValues values = new ContentValues()。 // 釋放數(shù)據(jù)庫資源 = city。 while (()) { city = ((code))。 Cursor cursor = null。 } ()。 try { cursor = (cities, new String[] { _id, code, city }, 25 city=?, new String[] { new String((), UTF8) }, null, null, null)。 } } catch (Exception e) { ()。 int count = 0。 } // 創(chuàng)建目錄 ()。 // 數(shù)據(jù)庫路徑 private String dbName = panda_weather。經(jīng)過分析可以知道,對數(shù)據(jù)庫的操作主要包括數(shù)據(jù)庫的初始化、由城市名得到對應的城市碼、設(shè)置默認城市碼和得到默認城市碼這樣四個操作。 和 select * from city。)。 接下來要進行的是創(chuàng)建 city 表,然后插入數(shù)據(jù),這里將默認的城市設(shè)置為北京,城市碼是 101010100 。 } ()。 String sql = INSERT INTO cities(_id, code, city) values( + (i+1) + ,?,?)。 for (int i = 0。在上面已經(jīng)將要插入的數(shù)據(jù)存入到了一個二維數(shù)組中,在插入的時候考慮到亂碼問題,特別設(shè)置了編碼方式為 UTF8 編碼,然后逐條插入,代碼如下: class InsertListener implements OnClickListener { public void onClick(View v) { DatabaseHelper dbHelper = new DatabaseHelper(, panda_weather)。 ()。得到 SQLiteOpenHelper 對象后就可以創(chuàng)建數(shù)據(jù)庫了。 public DatabaseHelper(Context context, String name, CursorFactory factory, int version) { super(context, name, factory, version)。 str[i][1] = city[i]。所以接下來要將它們組合起來,得到一個二維數(shù)組,一個城市名對應一個城市碼,共 2564 個城市,代碼如下: 21 public static String[][] range(String[] city, String[] code){ String[][] str = new String[2564][2]。 i = i + 1。 String[] it = new String[2564]。經(jīng)過分析可以知道,應該先將文件中的內(nèi)容讀入到內(nèi)存中,然后創(chuàng)建表,再把數(shù)據(jù)插入到表中。 20 } } return flag。 ()。 boolean flag = false。 } catch (Exception e) { ()。 g++。 j++) { for (int i = 0。 str = new StringBuffer()。 } } File file = new File()。 k++) { // info[g][0] = childs[j][k]。 for (int j = 0。 urlBuilder = null。 String[][] code = (webContent)。 // + 010203 + .xml urlBuilder = new StringBuffer(urlPre)。 j 。 } childs[i] = new String[sum]。 (.xml)。 for (int j = 0。 // 得到指定省份或直轄市信息內(nèi)容 webContent = (())。 i++) { // 得到省份名稱 groups[i] = provinces[i][1]。 String[][] childs = new String[][]。 String webContent。 } return null。 citys[i][0] = (0, index)。 while(()){ String city = ()。 int count = ()。 } return info。 String line。 String info = 。首先下載得到包含城市信息的文本內(nèi)容,然后再解析這個文本得到城市和編號。在獲取某一城市的天氣數(shù)據(jù)的時候,就是依據(jù)這個城市的城市碼向服務器發(fā)送請求,然后得到對應的天氣數(shù)據(jù)后返回,在界面中顯示給用戶,所有城市的天氣數(shù)據(jù)的獲取都依賴于對應的城市碼,所以得到所有的城市名及其城市碼就是重中之重的事情。 線性布局在代碼中表示為 Linearlayout,它是以線性的方式逐個顯示在它內(nèi)部聲明的控件,布局的方向有垂直和水平兩種,并且可以設(shè)置寬高等很多屬性。 等,其他命令與此類似。 Service 可以再多場合的應用中使用。 Intent 的使用具體有以下 3 種形式: 1. 通過 startActivity 方法來啟動一個新的 Activity; 2. 通過 Broadcast Intent 機制可以將一個 Intent 發(fā)送給任何對這個 Intent反省去的 BroadcastReceiver; 3. 通過 startService 或者 bindService 方法來和后臺的 Service 進行交互。 Intent Intent 是將一個要執(zhí)行的動作的抽象的描述,一般來說是作為參數(shù)來使用,由Intent 來協(xié)助完成 Android 各個組件之間的通訊。應用程序中用到的字符串、圖片、布局文件等等都可以在這里找到對應的 id,在使用的時候直接引用對應的 id 即可; :全局配置文件,程序中的 Activity、 Service、 Broadcast,還有權(quán)限聲明和其他需要注冊到 Android 系統(tǒng)中的等等應用,都需要在這里聲明過后 12 才能夠正常使用; 以上是對 Android 程序的目錄設(shè)置做了一個大概的介紹,針對本項目,包的設(shè)置和文件的 存放下面也給出詳解: 表 :包名介紹 包的名稱 說明 存放了 4 個界面類 數(shù)據(jù)的下載和解析等操作 數(shù)據(jù)庫操作 實體類 后臺服務 assets 存放數(shù)據(jù)庫文件 res 資源文件:圖片、布局文件等 相關(guān)技術(shù)介紹 Activity Activity 是 Android 平臺中非常重要的一個組件,是所有程序的根本,所有程序的流程都運行在 Activity 之中,是 Android 當中最基本的模塊之一。經(jīng)過了解,全國共有2564 個縣級以上城市,所以在 cities 表中共有 2564 條記錄,而在 city 表中只有一條記錄,表示如下: 表 : cities 字段名 數(shù)據(jù)類型 說明 _id Integer 主鍵 code varchar(10) 城市碼 city varchar(10) 城市名 表 : city 字段名 數(shù)據(jù)類型 說明 _id Integer 主鍵 code varchar(10) 默認城市碼 11 5 系統(tǒng)實現(xiàn) 文件結(jié)構(gòu)介紹 圖 :文件結(jié)構(gòu)圖 如圖 所示,為項目中的文件目錄結(jié)構(gòu)。 7 4 程序設(shè)計
點擊復制文檔內(nèi)容
公司管理相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1