【正文】
l version= encoding=utf8?news title=新聞中心 outline title=新聞要聞 xmlUrl= flag=sina_ddt encoding=utf8 / outline title=國內(nèi)要聞 xmlUrl= flag=sina_ddt encoding=utf8 / outline title=國際要聞 xmlUrl= flag=sina_ddt encoding=utf8 / outline title=社會新聞 xmlUrl= flag=sina_ddt encoding=utf8 / outline title=時政要聞 xmlUrl= flag=sina_ddt encoding=utf8 / ......其中title表示Rss的類型xmlUrl表示一個Rss地址連接encdoing表示Rss地址連接中的內(nèi)容的數(shù)據(jù)格式flag有特定的含義,根據(jù)Rss地址連接獲取到的每條信息都有一個對應(yīng)的連接,這個連接對應(yīng)的內(nèi)容用瀏覽器查看源文件,可以發(fā)現(xiàn)我們所需要的內(nèi)容一般在一塊特定的區(qū)域中,其他的信息我們都不需要,而且那些信息很浪費流量,根據(jù)這塊特定的區(qū)域,找出起始位置和結(jié)束位置,注意,這個起始和結(jié)束的位置在這個連接的源文件中必須是唯一的,flag中的值就是起始和結(jié)束位置,這個值對應(yīng)該項目中res/values/;例如時政要聞對應(yīng)的flag是sina_ddt,sina_ddt表示的內(nèi)容是:array name=sina_ddt itemstring/sina_ddt_begin/item itemstring/sina_ddt_end/item/array根據(jù)sina_ddt這個值就可以在代碼中解析出起始位置和結(jié)束位置,然后根據(jù)這兩個位置就可以解析出我們需要的內(nèi)容。 startFlipping:使用上面設(shè)置的時間間隔來開始切換所有的View,切換會循環(huán)進(jìn)行 圖61 瀏覽記錄頁面圖 圖62我的收藏界面圖2. 騰訊Rss界面的實現(xiàn)這個界面為了更好的用戶體驗,使用了ExpandableListView,ExpandableListView是Android中的手風(fēng)琴,個人感覺效果相當(dāng)棒,它是一個垂直滾動的顯示兩個級別列表項的視圖,如圖63所示,類似二級菜單,列表項來時ExpandableListAdapter;點擊組可以單獨展開。數(shù)據(jù)源來自本地xml文件的解析,將再后面介紹。Pull讀到XML文件的聲明,返回數(shù)字0,Pull讀到XML的結(jié)束,返回數(shù)字1,Pull讀到XML的開始標(biāo)簽,返回數(shù)字2,Pull讀到XML的結(jié)束標(biāo)簽,返回數(shù)字3,Pull讀到XML的文本,返回數(shù)字4,根據(jù)上面返回數(shù)字來進(jìn)行判斷,當(dāng)讀取到的開始標(biāo)簽是outline時,(int index)來獲取標(biāo)簽內(nèi)的值,(0)獲取的是title的值。本項目與互聯(lián)網(wǎng)進(jìn)行交互,因此網(wǎng)絡(luò)文件的解析是十分重要的一部分。這里將主要負(fù)責(zé)執(zhí)行那些很耗時的后臺計算工作。它能超高速解析HTML,而且不會出錯。 網(wǎng)頁內(nèi)容拷貝,用于將網(wǎng)頁內(nèi)容保存到本地 SharedPerferencePerference提供了一種輕量級的數(shù)據(jù)存儲方式,一般數(shù)據(jù)比較少,一些簡單的配置信息。s application tag, which will cause that class to be instantiated for you when the process for your application/package is created[8].就是說Application是用來保存全局變量的,并且是在Package創(chuàng)建的時候就跟著存在了。一般通過EditText的SetText方法來設(shè)置EditText中的文本,只需要對上面的代碼稍微做一下手腳,就可以實現(xiàn)將圖像插 入到EditText中的目的,要使用Html標(biāo)簽中有一個img標(biāo)簽。new }。,對應(yīng)的是drawable資源的ID值。參 考 文 獻(xiàn)[1] [M].北京:電子工業(yè)出版社,.[2] [M].北京:電子工業(yè)出版社,.[3] [M/CD].北京:水利水電出版社,.[4] Android SDK開發(fā)范例大全(第2版)[M].北京:人民郵電出版社,.[5] [J].南昌:計算機與現(xiàn)代化,:8589.[6] [M].Google公司,2008:132150.[7] HtmlParser API [8] (英) 2高級編程(第2版)[M]. 北京:清華大學(xué)出版社,.[9] [M].北京:機械工業(yè)出版社,.[10] 汪永松. Android平臺開發(fā)之旅[M].北京:機械工業(yè)出版社,.[11] Android開發(fā)網(wǎng). Android[DB/OL]. ,20080710.[12] Haseman Essentials[M]. Apress: the Expert’s Voice, 2008:156160.[13] DiMarzia : A Programmer’s Guide[M]. McGrawHill, 2008:85120.[14] [DB/OL]. ,20080730. Design and Development of RSS ReaderBased on Android PlatformAbstract: In pace with the ing of 3G time, the consumers of China Mobile can enjoy the service provided by the Internet in a high speed via GPRS. It39。 readerg an employment tribunal claiEmployment tribunals sort out disagreements between employers and employees.You may need to make a claim to an employment tribunal if:Further help.Employment tribunals are less formal than some other courts, but it is still a legal process and you will need to give evidence under an oath or affirmation.Most people find making a claim to an employment tribunal challenging. If you are thinking about making a claim to an employment tribunal, you should get help straight away from one of the organisations listed undernearest CAB.For more information about making a claim to an employment tribunal, seeCity39。二十年的人生軌跡深深淺淺,突然就感覺到有些事情,非做不可了。A person39。 Then in high school, think don39。s plaint. In a statement the Russian side added: We found no racist insults from fans of CSKA.Age has reached the end of the beginning of a word. May be guilty in his seems to passing a lot of different life became the appearance of the same day。s Premier League match at Chelsea on Sunday.I am going to be at the match tomorrow and I have asked to meet Yaya Toure, he told BBC Sport.For me it39。if you win the case.If you are thinking about signing up for Dismissal.You can make a claim to an employment tribunal, even if you haven39。Rss reader. What makes the software out of the ordinary is that it uses HtmlParse to analyse the html document files in order to get the appointed content and cut down the flow on GPRS as well software makes use of all kinds of groupwares offered by the Android to design the interface, so that it makes the consumers experience well .Key words: android。開發(fā)Rss閱讀器,要抓住開發(fā)的核心部分,Rss閱讀器的大體由我的收藏,歷史瀏覽,騰訊Rss,新浪Rss,內(nèi)容顯示,文件解析五大部分組成,只要掌握了這五部分的開發(fā),Rss閱讀器就初具規(guī)模。我們需要通過如下的代碼來使用img標(biāo)簽。}(0,d=public在啟動程序是,在Application中會加載我的收藏和瀏覽歷史的數(shù)據(jù),這些數(shù)據(jù)從數(shù)據(jù)庫中讀出,并存入HashMap和List中,這樣項目中的所有Activity都可以訪問這些數(shù)據(jù),比如在收藏時,數(shù)據(jù)會存入數(shù)據(jù)庫中,同時也會更新到在Application中設(shè)置的共享數(shù)據(jù)中,這樣在共享數(shù)據(jù)中還可以判斷數(shù)據(jù)是否收藏過,如果已經(jīng)收藏過直接在共享數(shù)據(jù)中判斷,而不必再次訪問數(shù)據(jù)庫,因為訪問數(shù)據(jù)庫比較耗性能,這樣做是為了提高的程序的響應(yīng)速度和性能。 Android中Application的應(yīng)用Android編程中,Application這樣的名詞似乎變得那樣的不常見,而讓大家更為熟悉的是Activity、Intent、Provider、Broadcast和Service。由于讀取Html數(shù)據(jù)需要連接互聯(lián)網(wǎng),所以將讀取和解析放在AsynTask中,避免ANR并動態(tài)更新。 資源提取,例如對一些圖片、聲音的資源的處理 onPostExecute(Result), 在doInBackground 執(zhí)行完成后,onPostExecute 方法將被UI thread調(diào)用,后臺的計算結(jié)果將通過該方法傳遞到UI thread. 使用AsyncTask類,以下是幾條必須遵守的準(zhǔn)則:(1)Task的實例必須在UI thread中創(chuàng)建 (2)execute方法必須在UI thread中調(diào)用 (3)不要手動的onPreExecute(),onPostExecute(Result),doInBackground(Params...), onProgressUpdate(Progress...)這幾個方法 (4) 該task只能被執(zhí)行一次,否則多次調(diào)用時將會出現(xiàn)異常2. 網(wǎng)絡(luò)XML文件的解析首先介紹XML文件的解析,對于XML的解析與本地XML文件解析相同,都是采用pull解析器,原理相同,只是解析不同的文件內(nèi)容,在這里解析的是RSS地址連接的內(nèi)容,這個內(nèi)容格式在前面已經(jīng)介紹過,不同的是解析本地文件的時候耗時比較短,而解析網(wǎng)絡(luò)文件耗時比較長,因為連接網(wǎng)絡(luò)耗時,讀取網(wǎng)絡(luò)資源也耗時;我們把這個耗時的操作放在上面介紹的AsynTask中處理,這樣就避免了ANR的現(xiàn)象,同時又能動態(tài)的加載內(nèi)容。在任務(wù)的執(zhí)行過程中,這些方法被自動調(diào)用。這種動態(tài)獲取類的信息,以及動態(tài)調(diào)用對象的方法的功能來自于Java語言的反射(Reflection)機制。 資源文件的解析 文件解析是本項目中的一個重點,主要包括本地文件的解析和網(wǎng)絡(luò)文件的解析。 圖63 騰訊Rss圖3. 新浪Rss界面的實現(xiàn) 新浪Rss界面 (GridView) 圖64 點擊新聞中心后(ListView) Rss界面跟其他的都不同,使用的是TabHost的組件,TabHost可是實現(xiàn)在不同一屏幕內(nèi)不同界面的切換。ListView需要一個適配器,android自帶的一些適配器如SimplaAdapter顯示比較單一,所以本軟件中繼承BaseAdapter,通過對這個適配器的擴(kuò)展實現(xiàn)我們需要的效果,擴(kuò)展成一行能顯示多個內(nèi)容。該方法主要執(zhí)行界面的初始化操作,Activity有個設(shè)置布局的方法:setContentView(int id),參數(shù)為資源ID,該id在工程目錄res/layout下,主界面的布局文件為main_tabs,下面是該布局文件的結(jié)構(gòu):?xml version= encoding=utf8?LinearLayout ViewFlipper include / include/ include / in