Android网络框架-Volley实践 使用Volley打造自定义ListView
這篇文章翻譯自Ravi Tamada博客中的Android Custom ListView with Image and Text using Volley
最終效果
這個ListView呈現了一些影視信息,每一行是一個影片的信息,每一行中有一張電影的圖片,電影的名字、評分、類型、年份等信息。
1.json數據
我們通過解析json然后拿到數據,這個json數據包括json數組,每個json數組中是一個json對象,json對象中包括了電影的圖片url地址、標題、年份、評分、類型等信息
JSON Url:http://api.androidhive.info/json/movies.json
| <a target=_blank id="L1" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L1" rel="#L1" style="color: rgb(102, 102, 102); text-decoration: none;"> 1</a> <a target=_blank id="L2" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L2" rel="#L2" style="color: rgb(102, 102, 102); text-decoration: none;"> 2</a> <a target=_blank id="L3" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L3" rel="#L3" style="color: rgb(102, 102, 102); text-decoration: none;"> 3</a> <a target=_blank id="L4" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L4" rel="#L4" style="color: rgb(102, 102, 102); text-decoration: none;"> 4</a> <a target=_blank id="L5" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L5" rel="#L5" style="color: rgb(102, 102, 102); text-decoration: none;"> 5</a> <a target=_blank id="L6" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L6" rel="#L6" style="color: rgb(102, 102, 102); text-decoration: none;"> 6</a> <a target=_blank id="L7" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L7" rel="#L7" style="color: rgb(102, 102, 102); text-decoration: none;"> 7</a> <a target=_blank id="L8" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L8" rel="#L8" style="color: rgb(102, 102, 102); text-decoration: none;"> 8</a> <a target=_blank id="L9" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L9" rel="#L9" style="color: rgb(102, 102, 102); text-decoration: none;"> 9</a> <a target=_blank id="L10" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L10" rel="#L10" style="color: rgb(102, 102, 102); text-decoration: none;"> 10</a> <a target=_blank id="L11" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L11" rel="#L11" style="color: rgb(102, 102, 102); text-decoration: none;"> 11</a> | [{"title": "Dawn of the Planet of the Apes","image": "http://api.androidhive.info/json/movies/1.jpg","rating": 8.3,"releaseYear": 2014,"genre": ["Action", "Drama", "Sci-Fi"]},........] |
?來自CODE的代碼片 json
2.下載Volley庫(volley.jar)
如果你第一次使用Volley框架,我建議你去我之前的文章看一下Android網絡框架-Volley(一) 工作原理分析?。然后到百度上下載一個volley.jar。添加到項目的lib文件夾里面
3.布局分析
我選擇了RelativeLayout來實現這個布局,圖片我們使用volley提供的NetworkImageView
現在我們來新建一個Android項目
4.創建一個新的項目
1.打開eclipse,點擊File-->New-->Android Application Project。填好基本信息后,我們把包名命名為info.androidhive.customlistviewvolley
2.將volley.jar添加到項目的lib文件夾下
3.我們先把包建好,我們一共分為4個包:?adapter,?app,?model?和?util? 。現在我們項目結構如下:
info.androidhive.customlistviewvolley.adater
info.androidhive.customlistviewvolley.app
info.androidhive.customlistviewvolley.model
info.androidhive.customlistviewvolley.util
4.打開res/values/colors.xml。如果沒有colors.xml,我們就自己創建一個。然后添加如下代碼
| <a target=_blank id="L1" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L1" rel="#L1" style="color: rgb(102, 102, 102); text-decoration: none;"> 1</a> <a target=_blank id="L2" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L2" rel="#L2" style="color: rgb(102, 102, 102); text-decoration: none;"> 2</a> <a target=_blank id="L3" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L3" rel="#L3" style="color: rgb(102, 102, 102); text-decoration: none;"> 3</a> <a target=_blank id="L4" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L4" rel="#L4" style="color: rgb(102, 102, 102); text-decoration: none;"> 4</a> <a target=_blank id="L5" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L5" rel="#L5" style="color: rgb(102, 102, 102); text-decoration: none;"> 5</a> <a target=_blank id="L6" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L6" rel="#L6" style="color: rgb(102, 102, 102); text-decoration: none;"> 6</a> <a target=_blank id="L7" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L7" rel="#L7" style="color: rgb(102, 102, 102); text-decoration: none;"> 7</a> <a target=_blank id="L8" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L8" rel="#L8" style="color: rgb(102, 102, 102); text-decoration: none;"> 8</a> <a target=_blank id="L9" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L9" rel="#L9" style="color: rgb(102, 102, 102); text-decoration: none;"> 9</a> <a target=_blank id="L10" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L10" rel="#L10" style="color: rgb(102, 102, 102); text-decoration: none;"> 10</a> <a target=_blank id="L11" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L11" rel="#L11" style="color: rgb(102, 102, 102); text-decoration: none;"> 11</a> <a target=_blank id="L12" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L12" rel="#L12" style="color: rgb(102, 102, 102); text-decoration: none;"> 12</a> | <?xml version="1.0" encoding="utf-8"?><resources> <color name="genre">#666666</color> <color name="year">#888888</color> <color name="list_divider">#d9d9d9</color> <color name="list_row_start_color">#ffffff</color> <color name="list_row_end_color">#ffffff</color> <color name="list_row_hover_start_color">#ebeef0</color> <color name="list_row_hover_end_color">#ebeef0</color> </resources> |
?來自CODE的代碼片 colors.xml
5.打開res/values/dimens.xml。添加如下代碼
| <a target=_blank id="L1" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L1" rel="#L1" style="color: rgb(102, 102, 102); text-decoration: none;"> 1</a> <a target=_blank id="L2" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L2" rel="#L2" style="color: rgb(102, 102, 102); text-decoration: none;"> 2</a> <a target=_blank id="L3" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L3" rel="#L3" style="color: rgb(102, 102, 102); text-decoration: none;"> 3</a> <a target=_blank id="L4" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L4" rel="#L4" style="color: rgb(102, 102, 102); text-decoration: none;"> 4</a> <a target=_blank id="L5" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L5" rel="#L5" style="color: rgb(102, 102, 102); text-decoration: none;"> 5</a> <a target=_blank id="L6" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L6" rel="#L6" style="color: rgb(102, 102, 102); text-decoration: none;"> 6</a> <a target=_blank id="L7" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L7" rel="#L7" style="color: rgb(102, 102, 102); text-decoration: none;"> 7</a> <a target=_blank id="L8" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L8" rel="#L8" style="color: rgb(102, 102, 102); text-decoration: none;"> 8</a> | <resources> <dimen name="title">17dp</dimen> <dimen name="rating">15dip</dimen> <dimen name="genre">13dip</dimen> <dimen name="year">12dip</dimen> </resources> |
?來自CODE的代碼片 dimens.xml
6.在寫jsva代碼之前,我們先完成UI部分,在res下新建一個drawable文件夾,在res/drawable中新建3個xml文件:list_row_bg.xml、list_row_bg_hover.xml?、list_row_selector.xml?。list_row_bg.xml?-沒有被點擊時listview的樣式
| <a target=_blank id="L1" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L1" rel="#L1" style="color: rgb(102, 102, 102); text-decoration: none;"> 1</a> <a target=_blank id="L2" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L2" rel="#L2" style="color: rgb(102, 102, 102); text-decoration: none;"> 2</a> <a target=_blank id="L3" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L3" rel="#L3" style="color: rgb(102, 102, 102); text-decoration: none;"> 3</a> <a target=_blank id="L4" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L4" rel="#L4" style="color: rgb(102, 102, 102); text-decoration: none;"> 4</a> <a target=_blank id="L5" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L5" rel="#L5" style="color: rgb(102, 102, 102); text-decoration: none;"> 5</a> <a target=_blank id="L6" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L6" rel="#L6" style="color: rgb(102, 102, 102); text-decoration: none;"> 6</a> <a target=_blank id="L7" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L7" rel="#L7" style="color: rgb(102, 102, 102); text-decoration: none;"> 7</a> <a target=_blank id="L8" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L8" rel="#L8" style="color: rgb(102, 102, 102); text-decoration: none;"> 8</a> | <?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"android:shape="rectangle"><gradientandroid:startColor="@color/list_row_start_color"android:endColor="@color/list_row_end_color"android:angle="270" /></shape> |
?來自CODE的代碼片 list_row_bg.xml-
list_row_bg_hover.xml?-被點擊后listview的樣式| <a target=_blank id="L1" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L1" rel="#L1" style="color: rgb(102, 102, 102); text-decoration: none;"> 1</a> <a target=_blank id="L2" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L2" rel="#L2" style="color: rgb(102, 102, 102); text-decoration: none;"> 2</a> <a target=_blank id="L3" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L3" rel="#L3" style="color: rgb(102, 102, 102); text-decoration: none;"> 3</a> <a target=_blank id="L4" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L4" rel="#L4" style="color: rgb(102, 102, 102); text-decoration: none;"> 4</a> <a target=_blank id="L5" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L5" rel="#L5" style="color: rgb(102, 102, 102); text-decoration: none;"> 5</a> <a target=_blank id="L6" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L6" rel="#L6" style="color: rgb(102, 102, 102); text-decoration: none;"> 6</a> <a target=_blank id="L7" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L7" rel="#L7" style="color: rgb(102, 102, 102); text-decoration: none;"> 7</a> <a target=_blank id="L8" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L8" rel="#L8" style="color: rgb(102, 102, 102); text-decoration: none;"> 8</a> <a target=_blank id="L9" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L9" rel="#L9" style="color: rgb(102, 102, 102); text-decoration: none;"> 9</a> <a target=_blank id="L10" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L10" rel="#L10" style="color: rgb(102, 102, 102); text-decoration: none;"> 10</a> | <?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:angle="270" android:endColor="@color/list_row_hover_end_color" android:startColor="@color/list_row_hover_start_color" /> </shape> |
?來自CODE的代碼片 list_row_bg_hover.xml
list_row_selector.xml?-切換兩種樣式的slector文件| <a target=_blank id="L1" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L1" rel="#L1" style="color: rgb(102, 102, 102); text-decoration: none;"> 1</a> <a target=_blank id="L2" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L2" rel="#L2" style="color: rgb(102, 102, 102); text-decoration: none;"> 2</a> <a target=_blank id="L3" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L3" rel="#L3" style="color: rgb(102, 102, 102); text-decoration: none;"> 3</a> <a target=_blank id="L4" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L4" rel="#L4" style="color: rgb(102, 102, 102); text-decoration: none;"> 4</a> <a target=_blank id="L5" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L5" rel="#L5" style="color: rgb(102, 102, 102); text-decoration: none;"> 5</a> <a target=_blank id="L6" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L6" rel="#L6" style="color: rgb(102, 102, 102); text-decoration: none;"> 6</a> <a target=_blank id="L7" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L7" rel="#L7" style="color: rgb(102, 102, 102); text-decoration: none;"> 7</a> <a target=_blank id="L8" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L8" rel="#L8" style="color: rgb(102, 102, 102); text-decoration: none;"> 8</a> | <?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/list_row_bg" android:state_pressed="false" android:state_selected="false"/> <item android:drawable="@drawable/list_row_bg_hover" android:state_pressed="true"/> <item android:drawable="@drawable/list_row_bg_hover" android:state_pressed="false" android:state_selected="true"/> </selector> |
?來自CODE的代碼片 list_row_selector.xml
7.打開activity_main.xml?添加listview
| <a target=_blank id="L1" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L1" rel="#L1" style="color: rgb(102, 102, 102); text-decoration: none;"> 1</a> <a target=_blank id="L2" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L2" rel="#L2" style="color: rgb(102, 102, 102); text-decoration: none;"> 2</a> <a target=_blank id="L3" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L3" rel="#L3" style="color: rgb(102, 102, 102); text-decoration: none;"> 3</a> <a target=_blank id="L4" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L4" rel="#L4" style="color: rgb(102, 102, 102); text-decoration: none;"> 4</a> <a target=_blank id="L5" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L5" rel="#L5" style="color: rgb(102, 102, 102); text-decoration: none;"> 5</a> <a target=_blank id="L6" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L6" rel="#L6" style="color: rgb(102, 102, 102); text-decoration: none;"> 6</a> <a target=_blank id="L7" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L7" rel="#L7" style="color: rgb(102, 102, 102); text-decoration: none;"> 7</a> <a target=_blank id="L8" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L8" rel="#L8" style="color: rgb(102, 102, 102); text-decoration: none;"> 8</a> <a target=_blank id="L9" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L9" rel="#L9" style="color: rgb(102, 102, 102); text-decoration: none;"> 9</a> <a target=_blank id="L10" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L10" rel="#L10" style="color: rgb(102, 102, 102); text-decoration: none;"> 10</a> <a target=_blank id="L11" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L11" rel="#L11" style="color: rgb(102, 102, 102); text-decoration: none;"> 11</a> <a target=_blank id="L12" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L12" rel="#L12" style="color: rgb(102, 102, 102); text-decoration: none;"> 12</a> <a target=_blank id="L13" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L13" rel="#L13" style="color: rgb(102, 102, 102); text-decoration: none;"> 13</a> <a target=_blank id="L14" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L14" rel="#L14" style="color: rgb(102, 102, 102); text-decoration: none;"> 14</a> <a target=_blank id="L15" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L15" rel="#L15" style="color: rgb(102, 102, 102); text-decoration: none;"> 15</a> | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" > <ListView android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:divider="@color/list_divider" android:dividerHeight="1dp" android:listSelector="@drawable/list_row_selector" /> </RelativeLayout> |
?來自CODE的代碼片 activity_main.xml
8.創建每個item的布局文件list_row.xml
| <a target=_blank id="L1" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L1" rel="#L1" style="color: rgb(102, 102, 102); text-decoration: none;"> 1</a> <a target=_blank id="L2" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L2" rel="#L2" style="color: rgb(102, 102, 102); text-decoration: none;"> 2</a> <a target=_blank id="L3" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L3" rel="#L3" style="color: rgb(102, 102, 102); text-decoration: none;"> 3</a> <a target=_blank id="L4" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L4" rel="#L4" style="color: rgb(102, 102, 102); text-decoration: none;"> 4</a> <a target=_blank id="L5" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L5" rel="#L5" style="color: rgb(102, 102, 102); text-decoration: none;"> 5</a> <a target=_blank id="L6" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L6" rel="#L6" style="color: rgb(102, 102, 102); text-decoration: none;"> 6</a> <a target=_blank id="L7" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L7" rel="#L7" style="color: rgb(102, 102, 102); text-decoration: none;"> 7</a> <a target=_blank id="L8" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L8" rel="#L8" style="color: rgb(102, 102, 102); text-decoration: none;"> 8</a> <a target=_blank id="L9" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L9" rel="#L9" style="color: rgb(102, 102, 102); text-decoration: none;"> 9</a> <a target=_blank id="L10" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L10" rel="#L10" style="color: rgb(102, 102, 102); text-decoration: none;"> 10</a> <a target=_blank id="L11" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L11" rel="#L11" style="color: rgb(102, 102, 102); text-decoration: none;"> 11</a> <a target=_blank id="L12" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L12" rel="#L12" style="color: rgb(102, 102, 102); text-decoration: none;"> 12</a> <a target=_blank id="L13" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L13" rel="#L13" style="color: rgb(102, 102, 102); text-decoration: none;"> 13</a> <a target=_blank id="L14" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L14" rel="#L14" style="color: rgb(102, 102, 102); text-decoration: none;"> 14</a> <a target=_blank id="L15" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L15" rel="#L15" style="color: rgb(102, 102, 102); text-decoration: none;"> 15</a> <a target=_blank id="L16" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L16" rel="#L16" style="color: rgb(102, 102, 102); text-decoration: none;"> 16</a> <a target=_blank id="L17" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L17" rel="#L17" style="color: rgb(102, 102, 102); text-decoration: none;"> 17</a> <a target=_blank id="L18" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L18" rel="#L18" style="color: rgb(102, 102, 102); text-decoration: none;"> 18</a> <a target=_blank id="L19" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L19" rel="#L19" style="color: rgb(102, 102, 102); text-decoration: none;"> 19</a> <a target=_blank id="L20" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L20" rel="#L20" style="color: rgb(102, 102, 102); text-decoration: none;"> 20</a> <a target=_blank id="L21" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L21" rel="#L21" style="color: rgb(102, 102, 102); text-decoration: none;"> 21</a> <a target=_blank id="L22" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L22" rel="#L22" style="color: rgb(102, 102, 102); text-decoration: none;"> 22</a> <a target=_blank id="L23" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L23" rel="#L23" style="color: rgb(102, 102, 102); text-decoration: none;"> 23</a> <a target=_blank id="L24" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L24" rel="#L24" style="color: rgb(102, 102, 102); text-decoration: none;"> 24</a> <a target=_blank id="L25" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L25" rel="#L25" style="color: rgb(102, 102, 102); text-decoration: none;"> 25</a> <a target=_blank id="L26" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L26" rel="#L26" style="color: rgb(102, 102, 102); text-decoration: none;"> 26</a> <a target=_blank id="L27" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L27" rel="#L27" style="color: rgb(102, 102, 102); text-decoration: none;"> 27</a> <a target=_blank id="L28" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L28" rel="#L28" style="color: rgb(102, 102, 102); text-decoration: none;"> 28</a> <a target=_blank id="L29" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L29" rel="#L29" style="color: rgb(102, 102, 102); text-decoration: none;"> 29</a> <a target=_blank id="L30" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L30" rel="#L30" style="color: rgb(102, 102, 102); text-decoration: none;"> 30</a> <a target=_blank id="L31" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L31" rel="#L31" style="color: rgb(102, 102, 102); text-decoration: none;"> 31</a> <a target=_blank id="L32" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L32" rel="#L32" style="color: rgb(102, 102, 102); text-decoration: none;"> 32</a> <a target=_blank id="L33" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L33" rel="#L33" style="color: rgb(102, 102, 102); text-decoration: none;"> 33</a> <a target=_blank id="L34" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L34" rel="#L34" style="color: rgb(102, 102, 102); text-decoration: none;"> 34</a> <a target=_blank id="L35" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L35" rel="#L35" style="color: rgb(102, 102, 102); text-decoration: none;"> 35</a> <a target=_blank id="L36" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L36" rel="#L36" style="color: rgb(102, 102, 102); text-decoration: none;"> 36</a> <a target=_blank id="L37" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L37" rel="#L37" style="color: rgb(102, 102, 102); text-decoration: none;"> 37</a> <a target=_blank id="L38" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L38" rel="#L38" style="color: rgb(102, 102, 102); text-decoration: none;"> 38</a> <a target=_blank id="L39" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L39" rel="#L39" style="color: rgb(102, 102, 102); text-decoration: none;"> 39</a> <a target=_blank id="L40" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L40" rel="#L40" style="color: rgb(102, 102, 102); text-decoration: none;"> 40</a> <a target=_blank id="L41" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L41" rel="#L41" style="color: rgb(102, 102, 102); text-decoration: none;"> 41</a> <a target=_blank id="L42" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L42" rel="#L42" style="color: rgb(102, 102, 102); text-decoration: none;"> 42</a> <a target=_blank id="L43" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L43" rel="#L43" style="color: rgb(102, 102, 102); text-decoration: none;"> 43</a> <a target=_blank id="L44" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L44" rel="#L44" style="color: rgb(102, 102, 102); text-decoration: none;"> 44</a> <a target=_blank id="L45" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L45" rel="#L45" style="color: rgb(102, 102, 102); text-decoration: none;"> 45</a> <a target=_blank id="L46" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L46" rel="#L46" style="color: rgb(102, 102, 102); text-decoration: none;"> 46</a> <a target=_blank id="L47" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L47" rel="#L47" style="color: rgb(102, 102, 102); text-decoration: none;"> 47</a> <a target=_blank id="L48" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L48" rel="#L48" style="color: rgb(102, 102, 102); text-decoration: none;"> 48</a> <a target=_blank id="L49" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L49" rel="#L49" style="color: rgb(102, 102, 102); text-decoration: none;"> 49</a> <a target=_blank id="L50" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L50" rel="#L50" style="color: rgb(102, 102, 102); text-decoration: none;"> 50</a> <a target=_blank id="L51" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L51" rel="#L51" style="color: rgb(102, 102, 102); text-decoration: none;"> 51</a> <a target=_blank id="L52" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L52" rel="#L52" style="color: rgb(102, 102, 102); text-decoration: none;"> 52</a> <a target=_blank id="L53" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L53" rel="#L53" style="color: rgb(102, 102, 102); text-decoration: none;"> 53</a> <a target=_blank id="L54" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L54" rel="#L54" style="color: rgb(102, 102, 102); text-decoration: none;"> 54</a> <a target=_blank id="L55" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L55" rel="#L55" style="color: rgb(102, 102, 102); text-decoration: none;"> 55</a> <a target=_blank id="L56" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L56" rel="#L56" style="color: rgb(102, 102, 102); text-decoration: none;"> 56</a> <a target=_blank id="L57" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L57" rel="#L57" style="color: rgb(102, 102, 102); text-decoration: none;"> 57</a> | <?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/list_row_selector" android:padding="8dp" > <!-- Volley的NetworkImageView --> <com.android.volley.toolbox.NetworkImageView android:id="@+id/thumbnail" android:layout_width="80dp" android:layout_height="80dp" android:layout_alignParentLeft="true" android:layout_marginRight="8dp" /> <!-- 影片標題 --> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@+id/thumbnail" android:layout_toRightOf="@+id/thumbnail" android:textSize="@dimen/title" android:textStyle="bold" /> <!-- 評分 --> <TextView android:id="@+id/rating" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/title" android:layout_marginTop="1dip" android:layout_toRightOf="@+id/thumbnail" android:textSize="@dimen/rating" /> <!-- 類別 --> <TextView android:id="@+id/genre" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/rating" android:layout_marginTop="5dp" android:layout_toRightOf="@+id/thumbnail" android:textColor="@color/genre" android:textSize="@dimen/genre" /> <!-- 年份 --> <TextView android:id="@+id/releaseYear" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:textColor="@color/year" android:textSize="@dimen/year" /> </RelativeLayout> |
?來自CODE的代碼片 list_row.xml
UI部分我們已經完成了,接下來是java代碼部分 9.在util包下新建LruBitmapCache.java? 這個類是用來緩存圖片的,這個類我們在之前文章中已經分析過了。參見Android網絡框架-Volley(二) RequestQueue源碼分析以及建立一個RequestQueue| <a target=_blank id="L1" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L1" rel="#L1" style="color: rgb(102, 102, 102); text-decoration: none;"> 1</a> <a target=_blank id="L2" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L2" rel="#L2" style="color: rgb(102, 102, 102); text-decoration: none;"> 2</a> <a target=_blank id="L3" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L3" rel="#L3" style="color: rgb(102, 102, 102); text-decoration: none;"> 3</a> <a target=_blank id="L4" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L4" rel="#L4" style="color: rgb(102, 102, 102); text-decoration: none;"> 4</a> <a target=_blank id="L5" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L5" rel="#L5" style="color: rgb(102, 102, 102); text-decoration: none;"> 5</a> <a target=_blank id="L6" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L6" rel="#L6" style="color: rgb(102, 102, 102); text-decoration: none;"> 6</a> <a target=_blank id="L7" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L7" rel="#L7" style="color: rgb(102, 102, 102); text-decoration: none;"> 7</a> <a target=_blank id="L8" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L8" rel="#L8" style="color: rgb(102, 102, 102); text-decoration: none;"> 8</a> <a target=_blank id="L9" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L9" rel="#L9" style="color: rgb(102, 102, 102); text-decoration: none;"> 9</a> <a target=_blank id="L10" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L10" rel="#L10" style="color: rgb(102, 102, 102); text-decoration: none;"> 10</a> <a target=_blank id="L11" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L11" rel="#L11" style="color: rgb(102, 102, 102); text-decoration: none;"> 11</a> <a target=_blank id="L12" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L12" rel="#L12" style="color: rgb(102, 102, 102); text-decoration: none;"> 12</a> <a target=_blank id="L13" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L13" rel="#L13" style="color: rgb(102, 102, 102); text-decoration: none;"> 13</a> <a target=_blank id="L14" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L14" rel="#L14" style="color: rgb(102, 102, 102); text-decoration: none;"> 14</a> <a target=_blank id="L15" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L15" rel="#L15" style="color: rgb(102, 102, 102); text-decoration: none;"> 15</a> <a target=_blank id="L16" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L16" rel="#L16" style="color: rgb(102, 102, 102); text-decoration: none;"> 16</a> <a target=_blank id="L17" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L17" rel="#L17" style="color: rgb(102, 102, 102); text-decoration: none;"> 17</a> <a target=_blank id="L18" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L18" rel="#L18" style="color: rgb(102, 102, 102); text-decoration: none;"> 18</a> <a target=_blank id="L19" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L19" rel="#L19" style="color: rgb(102, 102, 102); text-decoration: none;"> 19</a> <a target=_blank id="L20" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L20" rel="#L20" style="color: rgb(102, 102, 102); text-decoration: none;"> 20</a> <a target=_blank id="L21" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L21" rel="#L21" style="color: rgb(102, 102, 102); text-decoration: none;"> 21</a> <a target=_blank id="L22" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L22" rel="#L22" style="color: rgb(102, 102, 102); text-decoration: none;"> 22</a> <a target=_blank id="L23" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L23" rel="#L23" style="color: rgb(102, 102, 102); text-decoration: none;"> 23</a> <a target=_blank id="L24" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L24" rel="#L24" style="color: rgb(102, 102, 102); text-decoration: none;"> 24</a> <a target=_blank id="L25" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L25" rel="#L25" style="color: rgb(102, 102, 102); text-decoration: none;"> 25</a> <a target=_blank id="L26" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L26" rel="#L26" style="color: rgb(102, 102, 102); text-decoration: none;"> 26</a> <a target=_blank id="L27" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L27" rel="#L27" style="color: rgb(102, 102, 102); text-decoration: none;"> 27</a> <a target=_blank id="L28" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L28" rel="#L28" style="color: rgb(102, 102, 102); text-decoration: none;"> 28</a> <a target=_blank id="L29" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L29" rel="#L29" style="color: rgb(102, 102, 102); text-decoration: none;"> 29</a> <a target=_blank id="L30" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L30" rel="#L30" style="color: rgb(102, 102, 102); text-decoration: none;"> 30</a> <a target=_blank id="L31" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L31" rel="#L31" style="color: rgb(102, 102, 102); text-decoration: none;"> 31</a> <a target=_blank id="L32" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L32" rel="#L32" style="color: rgb(102, 102, 102); text-decoration: none;"> 32</a> <a target=_blank id="L33" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L33" rel="#L33" style="color: rgb(102, 102, 102); text-decoration: none;"> 33</a> <a target=_blank id="L34" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L34" rel="#L34" style="color: rgb(102, 102, 102); text-decoration: none;"> 34</a> <a target=_blank id="L35" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L35" rel="#L35" style="color: rgb(102, 102, 102); text-decoration: none;"> 35</a> <a target=_blank id="L36" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L36" rel="#L36" style="color: rgb(102, 102, 102); text-decoration: none;"> 36</a> <a target=_blank id="L37" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L37" rel="#L37" style="color: rgb(102, 102, 102); text-decoration: none;"> 37</a> <a target=_blank id="L38" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L38" rel="#L38" style="color: rgb(102, 102, 102); text-decoration: none;"> 38</a> <a target=_blank id="L39" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L39" rel="#L39" style="color: rgb(102, 102, 102); text-decoration: none;"> 39</a> | package info.androidhive.customlistviewvolley.util; import com.android.volley.toolbox.ImageLoader.ImageCache; import android.graphics.Bitmap;import android.support.v4.util.LruCache; public class LruBitmapCache extends LruCache<String, Bitmap> implements ImageCache { public static int getDefaultLruCacheSize() { final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024); final int cacheSize = maxMemory / 2; return cacheSize; } public LruBitmapCache() { this(getDefaultLruCacheSize()); } public LruBitmapCache(int sizeInKiloBytes) { super(sizeInKiloBytes); } @Override protected int sizeOf(String key, Bitmap value) { return value.getRowBytes() * value.getHeight() / 1024; } @Override public Bitmap getBitmap(String url) { return get(url); } @Override public void putBitmap(String url, Bitmap bitmap) { put(url, bitmap); }} |
?來自CODE的代碼片 LruBitmapCache.java
10.在app包下新建AppController.java? 這個類是用來創建一個單例RequestQueue的,以及初始化一些volley核心對象| <a target=_blank id="L1" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L1" rel="#L1" style="color: rgb(102, 102, 102); text-decoration: none;"> 1</a> <a target=_blank id="L2" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L2" rel="#L2" style="color: rgb(102, 102, 102); text-decoration: none;"> 2</a> <a target=_blank id="L3" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L3" rel="#L3" style="color: rgb(102, 102, 102); text-decoration: none;"> 3</a> <a target=_blank id="L4" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L4" rel="#L4" style="color: rgb(102, 102, 102); text-decoration: none;"> 4</a> <a target=_blank id="L5" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L5" rel="#L5" style="color: rgb(102, 102, 102); text-decoration: none;"> 5</a> <a target=_blank id="L6" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L6" rel="#L6" style="color: rgb(102, 102, 102); text-decoration: none;"> 6</a> <a target=_blank id="L7" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L7" rel="#L7" style="color: rgb(102, 102, 102); text-decoration: none;"> 7</a> <a target=_blank id="L8" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L8" rel="#L8" style="color: rgb(102, 102, 102); text-decoration: none;"> 8</a> <a target=_blank id="L9" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L9" rel="#L9" style="color: rgb(102, 102, 102); text-decoration: none;"> 9</a> <a target=_blank id="L10" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L10" rel="#L10" style="color: rgb(102, 102, 102); text-decoration: none;"> 10</a> <a target=_blank id="L11" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L11" rel="#L11" style="color: rgb(102, 102, 102); text-decoration: none;"> 11</a> <a target=_blank id="L12" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L12" rel="#L12" style="color: rgb(102, 102, 102); text-decoration: none;"> 12</a> <a target=_blank id="L13" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L13" rel="#L13" style="color: rgb(102, 102, 102); text-decoration: none;"> 13</a> <a target=_blank id="L14" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L14" rel="#L14" style="color: rgb(102, 102, 102); text-decoration: none;"> 14</a> <a target=_blank id="L15" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L15" rel="#L15" style="color: rgb(102, 102, 102); text-decoration: none;"> 15</a> <a target=_blank id="L16" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L16" rel="#L16" style="color: rgb(102, 102, 102); text-decoration: none;"> 16</a> <a target=_blank id="L17" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L17" rel="#L17" style="color: rgb(102, 102, 102); text-decoration: none;"> 17</a> <a target=_blank id="L18" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L18" rel="#L18" style="color: rgb(102, 102, 102); text-decoration: none;"> 18</a> <a target=_blank id="L19" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L19" rel="#L19" style="color: rgb(102, 102, 102); text-decoration: none;"> 19</a> <a target=_blank id="L20" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L20" rel="#L20" style="color: rgb(102, 102, 102); text-decoration: none;"> 20</a> <a target=_blank id="L21" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L21" rel="#L21" style="color: rgb(102, 102, 102); text-decoration: none;"> 21</a> <a target=_blank id="L22" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L22" rel="#L22" style="color: rgb(102, 102, 102); text-decoration: none;"> 22</a> <a target=_blank id="L23" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L23" rel="#L23" style="color: rgb(102, 102, 102); text-decoration: none;"> 23</a> <a target=_blank id="L24" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L24" rel="#L24" style="color: rgb(102, 102, 102); text-decoration: none;"> 24</a> <a target=_blank id="L25" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L25" rel="#L25" style="color: rgb(102, 102, 102); text-decoration: none;"> 25</a> <a target=_blank id="L26" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L26" rel="#L26" style="color: rgb(102, 102, 102); text-decoration: none;"> 26</a> <a target=_blank id="L27" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L27" rel="#L27" style="color: rgb(102, 102, 102); text-decoration: none;"> 27</a> <a target=_blank id="L28" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L28" rel="#L28" style="color: rgb(102, 102, 102); text-decoration: none;"> 28</a> <a target=_blank id="L29" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L29" rel="#L29" style="color: rgb(102, 102, 102); text-decoration: none;"> 29</a> <a target=_blank id="L30" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L30" rel="#L30" style="color: rgb(102, 102, 102); text-decoration: none;"> 30</a> <a target=_blank id="L31" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L31" rel="#L31" style="color: rgb(102, 102, 102); text-decoration: none;"> 31</a> <a target=_blank id="L32" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L32" rel="#L32" style="color: rgb(102, 102, 102); text-decoration: none;"> 32</a> <a target=_blank id="L33" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L33" rel="#L33" style="color: rgb(102, 102, 102); text-decoration: none;"> 33</a> <a target=_blank id="L34" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L34" rel="#L34" style="color: rgb(102, 102, 102); text-decoration: none;"> 34</a> <a target=_blank id="L35" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L35" rel="#L35" style="color: rgb(102, 102, 102); text-decoration: none;"> 35</a> <a target=_blank id="L36" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L36" rel="#L36" style="color: rgb(102, 102, 102); text-decoration: none;"> 36</a> <a target=_blank id="L37" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L37" rel="#L37" style="color: rgb(102, 102, 102); text-decoration: none;"> 37</a> <a target=_blank id="L38" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L38" rel="#L38" style="color: rgb(102, 102, 102); text-decoration: none;"> 38</a> <a target=_blank id="L39" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L39" rel="#L39" style="color: rgb(102, 102, 102); text-decoration: none;"> 39</a> <a target=_blank id="L40" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L40" rel="#L40" style="color: rgb(102, 102, 102); text-decoration: none;"> 40</a> <a target=_blank id="L41" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L41" rel="#L41" style="color: rgb(102, 102, 102); text-decoration: none;"> 41</a> <a target=_blank id="L42" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L42" rel="#L42" style="color: rgb(102, 102, 102); text-decoration: none;"> 42</a> <a target=_blank id="L43" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L43" rel="#L43" style="color: rgb(102, 102, 102); text-decoration: none;"> 43</a> <a target=_blank id="L44" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L44" rel="#L44" style="color: rgb(102, 102, 102); text-decoration: none;"> 44</a> <a target=_blank id="L45" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L45" rel="#L45" style="color: rgb(102, 102, 102); text-decoration: none;"> 45</a> <a target=_blank id="L46" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L46" rel="#L46" style="color: rgb(102, 102, 102); text-decoration: none;"> 46</a> <a target=_blank id="L47" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L47" rel="#L47" style="color: rgb(102, 102, 102); text-decoration: none;"> 47</a> <a target=_blank id="L48" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L48" rel="#L48" style="color: rgb(102, 102, 102); text-decoration: none;"> 48</a> <a target=_blank id="L49" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L49" rel="#L49" style="color: rgb(102, 102, 102); text-decoration: none;"> 49</a> <a target=_blank id="L50" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L50" rel="#L50" style="color: rgb(102, 102, 102); text-decoration: none;"> 50</a> <a target=_blank id="L51" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L51" rel="#L51" style="color: rgb(102, 102, 102); text-decoration: none;"> 51</a> <a target=_blank id="L52" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L52" rel="#L52" style="color: rgb(102, 102, 102); text-decoration: none;"> 52</a> <a target=_blank id="L53" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L53" rel="#L53" style="color: rgb(102, 102, 102); text-decoration: none;"> 53</a> <a target=_blank id="L54" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L54" rel="#L54" style="color: rgb(102, 102, 102); text-decoration: none;"> 54</a> <a target=_blank id="L55" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L55" rel="#L55" style="color: rgb(102, 102, 102); text-decoration: none;"> 55</a> <a target=_blank id="L56" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L56" rel="#L56" style="color: rgb(102, 102, 102); text-decoration: none;"> 56</a> <a target=_blank id="L57" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L57" rel="#L57" style="color: rgb(102, 102, 102); text-decoration: none;"> 57</a> <a target=_blank id="L58" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L58" rel="#L58" style="color: rgb(102, 102, 102); text-decoration: none;"> 58</a> <a target=_blank id="L59" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L59" rel="#L59" style="color: rgb(102, 102, 102); text-decoration: none;"> 59</a> <a target=_blank id="L60" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L60" rel="#L60" style="color: rgb(102, 102, 102); text-decoration: none;"> 60</a> <a target=_blank id="L61" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L61" rel="#L61" style="color: rgb(102, 102, 102); text-decoration: none;"> 61</a> <a target=_blank id="L62" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L62" rel="#L62" style="color: rgb(102, 102, 102); text-decoration: none;"> 62</a> <a target=_blank id="L63" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L63" rel="#L63" style="color: rgb(102, 102, 102); text-decoration: none;"> 63</a> <a target=_blank id="L64" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L64" rel="#L64" style="color: rgb(102, 102, 102); text-decoration: none;"> 64</a> | package info.androidhive.customlistviewvolley.app; import info.androidhive.customlistviewvolley.util.LruBitmapCache;import android.app.Application;import android.text.TextUtils; import com.android.volley.Request;import com.android.volley.RequestQueue;import com.android.volley.toolbox.ImageLoader;import com.android.volley.toolbox.Volley; public class AppController extends Application { public static final String TAG = AppController.class.getSimpleName(); private RequestQueue mRequestQueue; private ImageLoader mImageLoader; private static AppController mInstance; @Override public void onCreate() { super.onCreate(); mInstance = this; } public static synchronized AppController getInstance() { return mInstance; } public RequestQueue getRequestQueue() { if (mRequestQueue == null) { mRequestQueue = Volley.newRequestQueue(getApplicationContext()); } return mRequestQueue; } public ImageLoader getImageLoader() { getRequestQueue(); if (mImageLoader == null) { mImageLoader = new ImageLoader(this.mRequestQueue, new LruBitmapCache()); } return this.mImageLoader; } public <T> void addToRequestQueue(Request<T> req, String tag) { // set the default tag if tag is empty req.setTag(TextUtils.isEmpty(tag) ? TAG : tag); getRequestQueue().add(req); } public <T> void addToRequestQueue(Request<T> req) { req.setTag(TAG); getRequestQueue().add(req); } public void cancelPendingRequests(Object tag) { if (mRequestQueue != null) { mRequestQueue.cancelAll(tag); } }} |
?來自CODE的代碼片 AppController.java
11.現在我們要在?AndroidManifest.xml? 中注冊這個AppController,并且添加上網絡權限| <a target=_blank id="L1" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L1" rel="#L1" style="color: rgb(102, 102, 102); text-decoration: none;"> 1</a> <a target=_blank id="L2" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L2" rel="#L2" style="color: rgb(102, 102, 102); text-decoration: none;"> 2</a> <a target=_blank id="L3" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L3" rel="#L3" style="color: rgb(102, 102, 102); text-decoration: none;"> 3</a> <a target=_blank id="L4" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L4" rel="#L4" style="color: rgb(102, 102, 102); text-decoration: none;"> 4</a> <a target=_blank id="L5" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L5" rel="#L5" style="color: rgb(102, 102, 102); text-decoration: none;"> 5</a> <a target=_blank id="L6" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L6" rel="#L6" style="color: rgb(102, 102, 102); text-decoration: none;"> 6</a> <a target=_blank id="L7" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L7" rel="#L7" style="color: rgb(102, 102, 102); text-decoration: none;"> 7</a> <a target=_blank id="L8" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L8" rel="#L8" style="color: rgb(102, 102, 102); text-decoration: none;"> 8</a> <a target=_blank id="L9" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L9" rel="#L9" style="color: rgb(102, 102, 102); text-decoration: none;"> 9</a> <a target=_blank id="L10" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L10" rel="#L10" style="color: rgb(102, 102, 102); text-decoration: none;"> 10</a> <a target=_blank id="L11" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L11" rel="#L11" style="color: rgb(102, 102, 102); text-decoration: none;"> 11</a> <a target=_blank id="L12" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L12" rel="#L12" style="color: rgb(102, 102, 102); text-decoration: none;"> 12</a> <a target=_blank id="L13" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L13" rel="#L13" style="color: rgb(102, 102, 102); text-decoration: none;"> 13</a> <a target=_blank id="L14" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L14" rel="#L14" style="color: rgb(102, 102, 102); text-decoration: none;"> 14</a> <a target=_blank id="L15" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L15" rel="#L15" style="color: rgb(102, 102, 102); text-decoration: none;"> 15</a> <a target=_blank id="L16" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L16" rel="#L16" style="color: rgb(102, 102, 102); text-decoration: none;"> 16</a> <a target=_blank id="L17" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L17" rel="#L17" style="color: rgb(102, 102, 102); text-decoration: none;"> 17</a> <a target=_blank id="L18" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L18" rel="#L18" style="color: rgb(102, 102, 102); text-decoration: none;"> 18</a> <a target=_blank id="L19" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L19" rel="#L19" style="color: rgb(102, 102, 102); text-decoration: none;"> 19</a> <a target=_blank id="L20" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L20" rel="#L20" style="color: rgb(102, 102, 102); text-decoration: none;"> 20</a> <a target=_blank id="L21" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L21" rel="#L21" style="color: rgb(102, 102, 102); text-decoration: none;"> 21</a> <a target=_blank id="L22" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L22" rel="#L22" style="color: rgb(102, 102, 102); text-decoration: none;"> 22</a> <a target=_blank id="L23" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L23" rel="#L23" style="color: rgb(102, 102, 102); text-decoration: none;"> 23</a> <a target=_blank id="L24" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L24" rel="#L24" style="color: rgb(102, 102, 102); text-decoration: none;"> 24</a> <a target=_blank id="L25" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L25" rel="#L25" style="color: rgb(102, 102, 102); text-decoration: none;"> 25</a> <a target=_blank id="L26" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L26" rel="#L26" style="color: rgb(102, 102, 102); text-decoration: none;"> 26</a> <a target=_blank id="L27" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L27" rel="#L27" style="color: rgb(102, 102, 102); text-decoration: none;"> 27</a> <a target=_blank id="L28" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L28" rel="#L28" style="color: rgb(102, 102, 102); text-decoration: none;"> 28</a> <a target=_blank id="L29" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L29" rel="#L29" style="color: rgb(102, 102, 102); text-decoration: none;"> 29</a> <a target=_blank id="L30" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L30" rel="#L30" style="color: rgb(102, 102, 102); text-decoration: none;"> 30</a> | <?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="info.androidhive.customlistviewvolley" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.INTERNET" /> <application android:name="info.androidhive.customlistviewvolley.app.AppController" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="info.androidhive.customlistviewvolley.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> |
?來自CODE的代碼片 AndroidManifest.xml
12.現在在model包下創建一個Movie實體類,解析完的json數據會保存到這個實體類中| <a target=_blank id="L1" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L1" rel="#L1" style="color: rgb(102, 102, 102); text-decoration: none;"> 1</a> <a target=_blank id="L2" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L2" rel="#L2" style="color: rgb(102, 102, 102); text-decoration: none;"> 2</a> <a target=_blank id="L3" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L3" rel="#L3" style="color: rgb(102, 102, 102); text-decoration: none;"> 3</a> <a target=_blank id="L4" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L4" rel="#L4" style="color: rgb(102, 102, 102); text-decoration: none;"> 4</a> <a target=_blank id="L5" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L5" rel="#L5" style="color: rgb(102, 102, 102); text-decoration: none;"> 5</a> <a target=_blank id="L6" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L6" rel="#L6" style="color: rgb(102, 102, 102); text-decoration: none;"> 6</a> <a target=_blank id="L7" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L7" rel="#L7" style="color: rgb(102, 102, 102); text-decoration: none;"> 7</a> <a target=_blank id="L8" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L8" rel="#L8" style="color: rgb(102, 102, 102); text-decoration: none;"> 8</a> <a target=_blank id="L9" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L9" rel="#L9" style="color: rgb(102, 102, 102); text-decoration: none;"> 9</a> <a target=_blank id="L10" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L10" rel="#L10" style="color: rgb(102, 102, 102); text-decoration: none;"> 10</a> <a target=_blank id="L11" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L11" rel="#L11" style="color: rgb(102, 102, 102); text-decoration: none;"> 11</a> <a target=_blank id="L12" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L12" rel="#L12" style="color: rgb(102, 102, 102); text-decoration: none;"> 12</a> <a target=_blank id="L13" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L13" rel="#L13" style="color: rgb(102, 102, 102); text-decoration: none;"> 13</a> <a target=_blank id="L14" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L14" rel="#L14" style="color: rgb(102, 102, 102); text-decoration: none;"> 14</a> <a target=_blank id="L15" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L15" rel="#L15" style="color: rgb(102, 102, 102); text-decoration: none;"> 15</a> <a target=_blank id="L16" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L16" rel="#L16" style="color: rgb(102, 102, 102); text-decoration: none;"> 16</a> <a target=_blank id="L17" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L17" rel="#L17" style="color: rgb(102, 102, 102); text-decoration: none;"> 17</a> <a target=_blank id="L18" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L18" rel="#L18" style="color: rgb(102, 102, 102); text-decoration: none;"> 18</a> <a target=_blank id="L19" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L19" rel="#L19" style="color: rgb(102, 102, 102); text-decoration: none;"> 19</a> <a target=_blank id="L20" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L20" rel="#L20" style="color: rgb(102, 102, 102); text-decoration: none;"> 20</a> <a target=_blank id="L21" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L21" rel="#L21" style="color: rgb(102, 102, 102); text-decoration: none;"> 21</a> <a target=_blank id="L22" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L22" rel="#L22" style="color: rgb(102, 102, 102); text-decoration: none;"> 22</a> <a target=_blank id="L23" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L23" rel="#L23" style="color: rgb(102, 102, 102); text-decoration: none;"> 23</a> <a target=_blank id="L24" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L24" rel="#L24" style="color: rgb(102, 102, 102); text-decoration: none;"> 24</a> <a target=_blank id="L25" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L25" rel="#L25" style="color: rgb(102, 102, 102); text-decoration: none;"> 25</a> <a target=_blank id="L26" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L26" rel="#L26" style="color: rgb(102, 102, 102); text-decoration: none;"> 26</a> <a target=_blank id="L27" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L27" rel="#L27" style="color: rgb(102, 102, 102); text-decoration: none;"> 27</a> <a target=_blank id="L28" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L28" rel="#L28" style="color: rgb(102, 102, 102); text-decoration: none;"> 28</a> <a target=_blank id="L29" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L29" rel="#L29" style="color: rgb(102, 102, 102); text-decoration: none;"> 29</a> <a target=_blank id="L30" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L30" rel="#L30" style="color: rgb(102, 102, 102); text-decoration: none;"> 30</a> <a target=_blank id="L31" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L31" rel="#L31" style="color: rgb(102, 102, 102); text-decoration: none;"> 31</a> <a target=_blank id="L32" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L32" rel="#L32" style="color: rgb(102, 102, 102); text-decoration: none;"> 32</a> <a target=_blank id="L33" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L33" rel="#L33" style="color: rgb(102, 102, 102); text-decoration: none;"> 33</a> <a target=_blank id="L34" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L34" rel="#L34" style="color: rgb(102, 102, 102); text-decoration: none;"> 34</a> <a target=_blank id="L35" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L35" rel="#L35" style="color: rgb(102, 102, 102); text-decoration: none;"> 35</a> <a target=_blank id="L36" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L36" rel="#L36" style="color: rgb(102, 102, 102); text-decoration: none;"> 36</a> <a target=_blank id="L37" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L37" rel="#L37" style="color: rgb(102, 102, 102); text-decoration: none;"> 37</a> <a target=_blank id="L38" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L38" rel="#L38" style="color: rgb(102, 102, 102); text-decoration: none;"> 38</a> <a target=_blank id="L39" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L39" rel="#L39" style="color: rgb(102, 102, 102); text-decoration: none;"> 39</a> <a target=_blank id="L40" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L40" rel="#L40" style="color: rgb(102, 102, 102); text-decoration: none;"> 40</a> <a target=_blank id="L41" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L41" rel="#L41" style="color: rgb(102, 102, 102); text-decoration: none;"> 41</a> <a target=_blank id="L42" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L42" rel="#L42" style="color: rgb(102, 102, 102); text-decoration: none;"> 42</a> <a target=_blank id="L43" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L43" rel="#L43" style="color: rgb(102, 102, 102); text-decoration: none;"> 43</a> <a target=_blank id="L44" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L44" rel="#L44" style="color: rgb(102, 102, 102); text-decoration: none;"> 44</a> <a target=_blank id="L45" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L45" rel="#L45" style="color: rgb(102, 102, 102); text-decoration: none;"> 45</a> <a target=_blank id="L46" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L46" rel="#L46" style="color: rgb(102, 102, 102); text-decoration: none;"> 46</a> <a target=_blank id="L47" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L47" rel="#L47" style="color: rgb(102, 102, 102); text-decoration: none;"> 47</a> <a target=_blank id="L48" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L48" rel="#L48" style="color: rgb(102, 102, 102); text-decoration: none;"> 48</a> <a target=_blank id="L49" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L49" rel="#L49" style="color: rgb(102, 102, 102); text-decoration: none;"> 49</a> <a target=_blank id="L50" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L50" rel="#L50" style="color: rgb(102, 102, 102); text-decoration: none;"> 50</a> <a target=_blank id="L51" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L51" rel="#L51" style="color: rgb(102, 102, 102); text-decoration: none;"> 51</a> <a target=_blank id="L52" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L52" rel="#L52" style="color: rgb(102, 102, 102); text-decoration: none;"> 52</a> <a target=_blank id="L53" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L53" rel="#L53" style="color: rgb(102, 102, 102); text-decoration: none;"> 53</a> <a target=_blank id="L54" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L54" rel="#L54" style="color: rgb(102, 102, 102); text-decoration: none;"> 54</a> <a target=_blank id="L55" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L55" rel="#L55" style="color: rgb(102, 102, 102); text-decoration: none;"> 55</a> <a target=_blank id="L56" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L56" rel="#L56" style="color: rgb(102, 102, 102); text-decoration: none;"> 56</a> <a target=_blank id="L57" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L57" rel="#L57" style="color: rgb(102, 102, 102); text-decoration: none;"> 57</a> <a target=_blank id="L58" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L58" rel="#L58" style="color: rgb(102, 102, 102); text-decoration: none;"> 58</a> <a target=_blank id="L59" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L59" rel="#L59" style="color: rgb(102, 102, 102); text-decoration: none;"> 59</a> <a target=_blank id="L60" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L60" rel="#L60" style="color: rgb(102, 102, 102); text-decoration: none;"> 60</a> <a target=_blank id="L61" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L61" rel="#L61" style="color: rgb(102, 102, 102); text-decoration: none;"> 61</a> <a target=_blank id="L62" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L62" rel="#L62" style="color: rgb(102, 102, 102); text-decoration: none;"> 62</a> <a target=_blank id="L63" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L63" rel="#L63" style="color: rgb(102, 102, 102); text-decoration: none;"> 63</a> <a target=_blank id="L64" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L64" rel="#L64" style="color: rgb(102, 102, 102); text-decoration: none;"> 64</a> <a target=_blank id="L65" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L65" rel="#L65" style="color: rgb(102, 102, 102); text-decoration: none;"> 65</a> <a target=_blank id="L66" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L66" rel="#L66" style="color: rgb(102, 102, 102); text-decoration: none;"> 66</a> <a target=_blank id="L67" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L67" rel="#L67" style="color: rgb(102, 102, 102); text-decoration: none;"> 67</a> | package info.androidhive.customlistviewvolley.model; import java.util.ArrayList; public class Movie { //title=標題, thumbnailUrl=圖片地址 private String title, thumbnailUrl; //年份 private int year; //評分 private double rating; //類別 private ArrayList<String> genre; public Movie() { } public Movie(String name, String thumbnailUrl, int year, double rating, ArrayList<String> genre) { this.title = name; this.thumbnailUrl = thumbnailUrl; this.year = year; this.rating = rating; this.genre = genre; } public String getTitle() { return title; } public void setTitle(String name) { this.title = name; } public String getThumbnailUrl() { return thumbnailUrl; } public void setThumbnailUrl(String thumbnailUrl) { this.thumbnailUrl = thumbnailUrl; } public int getYear() { return year; } public void setYear(int year) { this.year = year; } public double getRating() { return rating; } public void setRating(double rating) { this.rating = rating; } public ArrayList<String> getGenre() { return genre; } public void setGenre(ArrayList<String> genre) { this.genre = genre; } } |
?來自CODE的代碼片 Movie.java
13.在adapter包下新建一個?CustomListAdapter.java? adapter會將item布局加載出來,并且將數據顯示到listview上面| <a target=_blank id="L1" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L1" rel="#L1" style="color: rgb(102, 102, 102); text-decoration: none;"> 1</a> <a target=_blank id="L2" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L2" rel="#L2" style="color: rgb(102, 102, 102); text-decoration: none;"> 2</a> <a target=_blank id="L3" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L3" rel="#L3" style="color: rgb(102, 102, 102); text-decoration: none;"> 3</a> <a target=_blank id="L4" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L4" rel="#L4" style="color: rgb(102, 102, 102); text-decoration: none;"> 4</a> <a target=_blank id="L5" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L5" rel="#L5" style="color: rgb(102, 102, 102); text-decoration: none;"> 5</a> <a target=_blank id="L6" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L6" rel="#L6" style="color: rgb(102, 102, 102); text-decoration: none;"> 6</a> <a target=_blank id="L7" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L7" rel="#L7" style="color: rgb(102, 102, 102); text-decoration: none;"> 7</a> <a target=_blank id="L8" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L8" rel="#L8" style="color: rgb(102, 102, 102); text-decoration: none;"> 8</a> <a target=_blank id="L9" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L9" rel="#L9" style="color: rgb(102, 102, 102); text-decoration: none;"> 9</a> <a target=_blank id="L10" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L10" rel="#L10" style="color: rgb(102, 102, 102); text-decoration: none;"> 10</a> <a target=_blank id="L11" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L11" rel="#L11" style="color: rgb(102, 102, 102); text-decoration: none;"> 11</a> <a target=_blank id="L12" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L12" rel="#L12" style="color: rgb(102, 102, 102); text-decoration: none;"> 12</a> <a target=_blank id="L13" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L13" rel="#L13" style="color: rgb(102, 102, 102); text-decoration: none;"> 13</a> <a target=_blank id="L14" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L14" rel="#L14" style="color: rgb(102, 102, 102); text-decoration: none;"> 14</a> <a target=_blank id="L15" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L15" rel="#L15" style="color: rgb(102, 102, 102); text-decoration: none;"> 15</a> <a target=_blank id="L16" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L16" rel="#L16" style="color: rgb(102, 102, 102); text-decoration: none;"> 16</a> <a target=_blank id="L17" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L17" rel="#L17" style="color: rgb(102, 102, 102); text-decoration: none;"> 17</a> <a target=_blank id="L18" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L18" rel="#L18" style="color: rgb(102, 102, 102); text-decoration: none;"> 18</a> <a target=_blank id="L19" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L19" rel="#L19" style="color: rgb(102, 102, 102); text-decoration: none;"> 19</a> <a target=_blank id="L20" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L20" rel="#L20" style="color: rgb(102, 102, 102); text-decoration: none;"> 20</a> <a target=_blank id="L21" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L21" rel="#L21" style="color: rgb(102, 102, 102); text-decoration: none;"> 21</a> <a target=_blank id="L22" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L22" rel="#L22" style="color: rgb(102, 102, 102); text-decoration: none;"> 22</a> <a target=_blank id="L23" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L23" rel="#L23" style="color: rgb(102, 102, 102); text-decoration: none;"> 23</a> <a target=_blank id="L24" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L24" rel="#L24" style="color: rgb(102, 102, 102); text-decoration: none;"> 24</a> <a target=_blank id="L25" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L25" rel="#L25" style="color: rgb(102, 102, 102); text-decoration: none;"> 25</a> <a target=_blank id="L26" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L26" rel="#L26" style="color: rgb(102, 102, 102); text-decoration: none;"> 26</a> <a target=_blank id="L27" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L27" rel="#L27" style="color: rgb(102, 102, 102); text-decoration: none;"> 27</a> <a target=_blank id="L28" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L28" rel="#L28" style="color: rgb(102, 102, 102); text-decoration: none;"> 28</a> <a target=_blank id="L29" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L29" rel="#L29" style="color: rgb(102, 102, 102); text-decoration: none;"> 29</a> <a target=_blank id="L30" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L30" rel="#L30" style="color: rgb(102, 102, 102); text-decoration: none;"> 30</a> <a target=_blank id="L31" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L31" rel="#L31" style="color: rgb(102, 102, 102); text-decoration: none;"> 31</a> <a target=_blank id="L32" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L32" rel="#L32" style="color: rgb(102, 102, 102); text-decoration: none;"> 32</a> <a target=_blank id="L33" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L33" rel="#L33" style="color: rgb(102, 102, 102); text-decoration: none;"> 33</a> <a target=_blank id="L34" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L34" rel="#L34" style="color: rgb(102, 102, 102); text-decoration: none;"> 34</a> <a target=_blank id="L35" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L35" rel="#L35" style="color: rgb(102, 102, 102); text-decoration: none;"> 35</a> <a target=_blank id="L36" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L36" rel="#L36" style="color: rgb(102, 102, 102); text-decoration: none;"> 36</a> <a target=_blank id="L37" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L37" rel="#L37" style="color: rgb(102, 102, 102); text-decoration: none;"> 37</a> <a target=_blank id="L38" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L38" rel="#L38" style="color: rgb(102, 102, 102); text-decoration: none;"> 38</a> <a target=_blank id="L39" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L39" rel="#L39" style="color: rgb(102, 102, 102); text-decoration: none;"> 39</a> <a target=_blank id="L40" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L40" rel="#L40" style="color: rgb(102, 102, 102); text-decoration: none;"> 40</a> <a target=_blank id="L41" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L41" rel="#L41" style="color: rgb(102, 102, 102); text-decoration: none;"> 41</a> <a target=_blank id="L42" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L42" rel="#L42" style="color: rgb(102, 102, 102); text-decoration: none;"> 42</a> <a target=_blank id="L43" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L43" rel="#L43" style="color: rgb(102, 102, 102); text-decoration: none;"> 43</a> <a target=_blank id="L44" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L44" rel="#L44" style="color: rgb(102, 102, 102); text-decoration: none;"> 44</a> <a target=_blank id="L45" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L45" rel="#L45" style="color: rgb(102, 102, 102); text-decoration: none;"> 45</a> <a target=_blank id="L46" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L46" rel="#L46" style="color: rgb(102, 102, 102); text-decoration: none;"> 46</a> <a target=_blank id="L47" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L47" rel="#L47" style="color: rgb(102, 102, 102); text-decoration: none;"> 47</a> <a target=_blank id="L48" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L48" rel="#L48" style="color: rgb(102, 102, 102); text-decoration: none;"> 48</a> <a target=_blank id="L49" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L49" rel="#L49" style="color: rgb(102, 102, 102); text-decoration: none;"> 49</a> <a target=_blank id="L50" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L50" rel="#L50" style="color: rgb(102, 102, 102); text-decoration: none;"> 50</a> <a target=_blank id="L51" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L51" rel="#L51" style="color: rgb(102, 102, 102); text-decoration: none;"> 51</a> <a target=_blank id="L52" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L52" rel="#L52" style="color: rgb(102, 102, 102); text-decoration: none;"> 52</a> <a target=_blank id="L53" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L53" rel="#L53" style="color: rgb(102, 102, 102); text-decoration: none;"> 53</a> <a target=_blank id="L54" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L54" rel="#L54" style="color: rgb(102, 102, 102); text-decoration: none;"> 54</a> <a target=_blank id="L55" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L55" rel="#L55" style="color: rgb(102, 102, 102); text-decoration: none;"> 55</a> <a target=_blank id="L56" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L56" rel="#L56" style="color: rgb(102, 102, 102); text-decoration: none;"> 56</a> <a target=_blank id="L57" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L57" rel="#L57" style="color: rgb(102, 102, 102); text-decoration: none;"> 57</a> <a target=_blank id="L58" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L58" rel="#L58" style="color: rgb(102, 102, 102); text-decoration: none;"> 58</a> <a target=_blank id="L59" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L59" rel="#L59" style="color: rgb(102, 102, 102); text-decoration: none;"> 59</a> <a target=_blank id="L60" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L60" rel="#L60" style="color: rgb(102, 102, 102); text-decoration: none;"> 60</a> <a target=_blank id="L61" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L61" rel="#L61" style="color: rgb(102, 102, 102); text-decoration: none;"> 61</a> <a target=_blank id="L62" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L62" rel="#L62" style="color: rgb(102, 102, 102); text-decoration: none;"> 62</a> <a target=_blank id="L63" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L63" rel="#L63" style="color: rgb(102, 102, 102); text-decoration: none;"> 63</a> <a target=_blank id="L64" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L64" rel="#L64" style="color: rgb(102, 102, 102); text-decoration: none;"> 64</a> <a target=_blank id="L65" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L65" rel="#L65" style="color: rgb(102, 102, 102); text-decoration: none;"> 65</a> <a target=_blank id="L66" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L66" rel="#L66" style="color: rgb(102, 102, 102); text-decoration: none;"> 66</a> <a target=_blank id="L67" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L67" rel="#L67" style="color: rgb(102, 102, 102); text-decoration: none;"> 67</a> <a target=_blank id="L68" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L68" rel="#L68" style="color: rgb(102, 102, 102); text-decoration: none;"> 68</a> <a target=_blank id="L69" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L69" rel="#L69" style="color: rgb(102, 102, 102); text-decoration: none;"> 69</a> <a target=_blank id="L70" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L70" rel="#L70" style="color: rgb(102, 102, 102); text-decoration: none;"> 70</a> <a target=_blank id="L71" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L71" rel="#L71" style="color: rgb(102, 102, 102); text-decoration: none;"> 71</a> <a target=_blank id="L72" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L72" rel="#L72" style="color: rgb(102, 102, 102); text-decoration: none;"> 72</a> <a target=_blank id="L73" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L73" rel="#L73" style="color: rgb(102, 102, 102); text-decoration: none;"> 73</a> <a target=_blank id="L74" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L74" rel="#L74" style="color: rgb(102, 102, 102); text-decoration: none;"> 74</a> <a target=_blank id="L75" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L75" rel="#L75" style="color: rgb(102, 102, 102); text-decoration: none;"> 75</a> <a target=_blank id="L76" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L76" rel="#L76" style="color: rgb(102, 102, 102); text-decoration: none;"> 76</a> <a target=_blank id="L77" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L77" rel="#L77" style="color: rgb(102, 102, 102); text-decoration: none;"> 77</a> <a target=_blank id="L78" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L78" rel="#L78" style="color: rgb(102, 102, 102); text-decoration: none;"> 78</a> <a target=_blank id="L79" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L79" rel="#L79" style="color: rgb(102, 102, 102); text-decoration: none;"> 79</a> <a target=_blank id="L80" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L80" rel="#L80" style="color: rgb(102, 102, 102); text-decoration: none;"> 80</a> <a target=_blank id="L81" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L81" rel="#L81" style="color: rgb(102, 102, 102); text-decoration: none;"> 81</a> <a target=_blank id="L82" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L82" rel="#L82" style="color: rgb(102, 102, 102); text-decoration: none;"> 82</a> <a target=_blank id="L83" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L83" rel="#L83" style="color: rgb(102, 102, 102); text-decoration: none;"> 83</a> <a target=_blank id="L84" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L84" rel="#L84" style="color: rgb(102, 102, 102); text-decoration: none;"> 84</a> <a target=_blank id="L85" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L85" rel="#L85" style="color: rgb(102, 102, 102); text-decoration: none;"> 85</a> <a target=_blank id="L86" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L86" rel="#L86" style="color: rgb(102, 102, 102); text-decoration: none;"> 86</a> <a target=_blank id="L87" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L87" rel="#L87" style="color: rgb(102, 102, 102); text-decoration: none;"> 87</a> <a target=_blank id="L88" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L88" rel="#L88" style="color: rgb(102, 102, 102); text-decoration: none;"> 88</a> <a target=_blank id="L89" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L89" rel="#L89" style="color: rgb(102, 102, 102); text-decoration: none;"> 89</a> <a target=_blank id="L90" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L90" rel="#L90" style="color: rgb(102, 102, 102); text-decoration: none;"> 90</a> <a target=_blank id="L91" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L91" rel="#L91" style="color: rgb(102, 102, 102); text-decoration: none;"> 91</a> | package info.androidhive.customlistviewvolley.adater; import info.androidhive.customlistviewvolley.R;import info.androidhive.customlistviewvolley.app.AppController;import info.androidhive.customlistviewvolley.model.Movie; import java.util.List; import android.app.Activity;import android.content.Context;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;import android.widget.BaseAdapter;import android.widget.TextView; import com.android.volley.toolbox.ImageLoader;import com.android.volley.toolbox.NetworkImageView; public class CustomListAdapter extends BaseAdapter { private Activity activity; private LayoutInflater inflater; private List<Movie> movieItems; ImageLoader imageLoader = AppController.getInstance().getImageLoader(); public CustomListAdapter(Activity activity, List<Movie> movieItems) { this.activity = activity; this.movieItems = movieItems; } @Override public int getCount() { return movieItems.size(); } @Override public Object getItem(int location) { return movieItems.get(location); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (inflater == null) inflater = (LayoutInflater) activity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); if (convertView == null) convertView = inflater.inflate(R.layout.list_row, null); if (imageLoader == null) imageLoader = AppController.getInstance().getImageLoader(); NetworkImageView thumbNail = (NetworkImageView) convertView .findViewById(R.id.thumbnail); TextView title = (TextView) convertView.findViewById(R.id.title); TextView rating = (TextView) convertView.findViewById(R.id.rating); TextView genre = (TextView) convertView.findViewById(R.id.genre); TextView year = (TextView) convertView.findViewById(R.id.releaseYear); // getting movie data for the row Movie m = movieItems.get(position); // thumbnail image thumbNail.setImageUrl(m.getThumbnailUrl(), imageLoader); // title title.setText(m.getTitle()); // rating rating.setText("Rating: " + String.valueOf(m.getRating())); // genre String genreStr = ""; for (String str : m.getGenre()) { genreStr += str + ", "; } genreStr = genreStr.length() > 0 ? genreStr.substring(0, genreStr.length() - 2) : genreStr; genre.setText(genreStr); // release year year.setText(String.valueOf(m.getYear())); return convertView; } } |
?來自CODE的代碼片 CustomListAdapter.java
14.打開我們的MainActivity.java。添加如下代碼,我們使用JsonArrayRequest來發送請求,發送json請求我們在Android網絡框架-Volley(四) 使用get和post方法發送json請求?已經講過了。我們將解析來的Movie對象存儲在一個ArrayList中,調用notifyDataSetChanged()方法通知listview去更新我們的數據。| <a target=_blank id="L1" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L1" rel="#L1" style="color: rgb(102, 102, 102); text-decoration: none;"> 1</a> <a target=_blank id="L2" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L2" rel="#L2" style="color: rgb(102, 102, 102); text-decoration: none;"> 2</a> <a target=_blank id="L3" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L3" rel="#L3" style="color: rgb(102, 102, 102); text-decoration: none;"> 3</a> <a target=_blank id="L4" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L4" rel="#L4" style="color: rgb(102, 102, 102); text-decoration: none;"> 4</a> <a target=_blank id="L5" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L5" rel="#L5" style="color: rgb(102, 102, 102); text-decoration: none;"> 5</a> <a target=_blank id="L6" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L6" rel="#L6" style="color: rgb(102, 102, 102); text-decoration: none;"> 6</a> <a target=_blank id="L7" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L7" rel="#L7" style="color: rgb(102, 102, 102); text-decoration: none;"> 7</a> <a target=_blank id="L8" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L8" rel="#L8" style="color: rgb(102, 102, 102); text-decoration: none;"> 8</a> <a target=_blank id="L9" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L9" rel="#L9" style="color: rgb(102, 102, 102); text-decoration: none;"> 9</a> <a target=_blank id="L10" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L10" rel="#L10" style="color: rgb(102, 102, 102); text-decoration: none;"> 10</a> <a target=_blank id="L11" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L11" rel="#L11" style="color: rgb(102, 102, 102); text-decoration: none;"> 11</a> <a target=_blank id="L12" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L12" rel="#L12" style="color: rgb(102, 102, 102); text-decoration: none;"> 12</a> <a target=_blank id="L13" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L13" rel="#L13" style="color: rgb(102, 102, 102); text-decoration: none;"> 13</a> <a target=_blank id="L14" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L14" rel="#L14" style="color: rgb(102, 102, 102); text-decoration: none;"> 14</a> <a target=_blank id="L15" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L15" rel="#L15" style="color: rgb(102, 102, 102); text-decoration: none;"> 15</a> <a target=_blank id="L16" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L16" rel="#L16" style="color: rgb(102, 102, 102); text-decoration: none;"> 16</a> <a target=_blank id="L17" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L17" rel="#L17" style="color: rgb(102, 102, 102); text-decoration: none;"> 17</a> <a target=_blank id="L18" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L18" rel="#L18" style="color: rgb(102, 102, 102); text-decoration: none;"> 18</a> <a target=_blank id="L19" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L19" rel="#L19" style="color: rgb(102, 102, 102); text-decoration: none;"> 19</a> <a target=_blank id="L20" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L20" rel="#L20" style="color: rgb(102, 102, 102); text-decoration: none;"> 20</a> <a target=_blank id="L21" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L21" rel="#L21" style="color: rgb(102, 102, 102); text-decoration: none;"> 21</a> <a target=_blank id="L22" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L22" rel="#L22" style="color: rgb(102, 102, 102); text-decoration: none;"> 22</a> <a target=_blank id="L23" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L23" rel="#L23" style="color: rgb(102, 102, 102); text-decoration: none;"> 23</a> <a target=_blank id="L24" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L24" rel="#L24" style="color: rgb(102, 102, 102); text-decoration: none;"> 24</a> <a target=_blank id="L25" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L25" rel="#L25" style="color: rgb(102, 102, 102); text-decoration: none;"> 25</a> <a target=_blank id="L26" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L26" rel="#L26" style="color: rgb(102, 102, 102); text-decoration: none;"> 26</a> <a target=_blank id="L27" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L27" rel="#L27" style="color: rgb(102, 102, 102); text-decoration: none;"> 27</a> <a target=_blank id="L28" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L28" rel="#L28" style="color: rgb(102, 102, 102); text-decoration: none;"> 28</a> <a target=_blank id="L29" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L29" rel="#L29" style="color: rgb(102, 102, 102); text-decoration: none;"> 29</a> <a target=_blank id="L30" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L30" rel="#L30" style="color: rgb(102, 102, 102); text-decoration: none;"> 30</a> <a target=_blank id="L31" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L31" rel="#L31" style="color: rgb(102, 102, 102); text-decoration: none;"> 31</a> <a target=_blank id="L32" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L32" rel="#L32" style="color: rgb(102, 102, 102); text-decoration: none;"> 32</a> <a target=_blank id="L33" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L33" rel="#L33" style="color: rgb(102, 102, 102); text-decoration: none;"> 33</a> <a target=_blank id="L34" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L34" rel="#L34" style="color: rgb(102, 102, 102); text-decoration: none;"> 34</a> <a target=_blank id="L35" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L35" rel="#L35" style="color: rgb(102, 102, 102); text-decoration: none;"> 35</a> <a target=_blank id="L36" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L36" rel="#L36" style="color: rgb(102, 102, 102); text-decoration: none;"> 36</a> <a target=_blank id="L37" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L37" rel="#L37" style="color: rgb(102, 102, 102); text-decoration: none;"> 37</a> <a target=_blank id="L38" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L38" rel="#L38" style="color: rgb(102, 102, 102); text-decoration: none;"> 38</a> <a target=_blank id="L39" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L39" rel="#L39" style="color: rgb(102, 102, 102); text-decoration: none;"> 39</a> <a target=_blank id="L40" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L40" rel="#L40" style="color: rgb(102, 102, 102); text-decoration: none;"> 40</a> <a target=_blank id="L41" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L41" rel="#L41" style="color: rgb(102, 102, 102); text-decoration: none;"> 41</a> <a target=_blank id="L42" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L42" rel="#L42" style="color: rgb(102, 102, 102); text-decoration: none;"> 42</a> <a target=_blank id="L43" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L43" rel="#L43" style="color: rgb(102, 102, 102); text-decoration: none;"> 43</a> <a target=_blank id="L44" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L44" rel="#L44" style="color: rgb(102, 102, 102); text-decoration: none;"> 44</a> <a target=_blank id="L45" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L45" rel="#L45" style="color: rgb(102, 102, 102); text-decoration: none;"> 45</a> <a target=_blank id="L46" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L46" rel="#L46" style="color: rgb(102, 102, 102); text-decoration: none;"> 46</a> <a target=_blank id="L47" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L47" rel="#L47" style="color: rgb(102, 102, 102); text-decoration: none;"> 47</a> <a target=_blank id="L48" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L48" rel="#L48" style="color: rgb(102, 102, 102); text-decoration: none;"> 48</a> <a target=_blank id="L49" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L49" rel="#L49" style="color: rgb(102, 102, 102); text-decoration: none;"> 49</a> <a target=_blank id="L50" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L50" rel="#L50" style="color: rgb(102, 102, 102); text-decoration: none;"> 50</a> <a target=_blank id="L51" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L51" rel="#L51" style="color: rgb(102, 102, 102); text-decoration: none;"> 51</a> <a target=_blank id="L52" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L52" rel="#L52" style="color: rgb(102, 102, 102); text-decoration: none;"> 52</a> <a target=_blank id="L53" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L53" rel="#L53" style="color: rgb(102, 102, 102); text-decoration: none;"> 53</a> <a target=_blank id="L54" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L54" rel="#L54" style="color: rgb(102, 102, 102); text-decoration: none;"> 54</a> <a target=_blank id="L55" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L55" rel="#L55" style="color: rgb(102, 102, 102); text-decoration: none;"> 55</a> <a target=_blank id="L56" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L56" rel="#L56" style="color: rgb(102, 102, 102); text-decoration: none;"> 56</a> <a target=_blank id="L57" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L57" rel="#L57" style="color: rgb(102, 102, 102); text-decoration: none;"> 57</a> <a target=_blank id="L58" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L58" rel="#L58" style="color: rgb(102, 102, 102); text-decoration: none;"> 58</a> <a target=_blank id="L59" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L59" rel="#L59" style="color: rgb(102, 102, 102); text-decoration: none;"> 59</a> <a target=_blank id="L60" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L60" rel="#L60" style="color: rgb(102, 102, 102); text-decoration: none;"> 60</a> <a target=_blank id="L61" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L61" rel="#L61" style="color: rgb(102, 102, 102); text-decoration: none;"> 61</a> <a target=_blank id="L62" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L62" rel="#L62" style="color: rgb(102, 102, 102); text-decoration: none;"> 62</a> <a target=_blank id="L63" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L63" rel="#L63" style="color: rgb(102, 102, 102); text-decoration: none;"> 63</a> <a target=_blank id="L64" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L64" rel="#L64" style="color: rgb(102, 102, 102); text-decoration: none;"> 64</a> <a target=_blank id="L65" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L65" rel="#L65" style="color: rgb(102, 102, 102); text-decoration: none;"> 65</a> <a target=_blank id="L66" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L66" rel="#L66" style="color: rgb(102, 102, 102); text-decoration: none;"> 66</a> <a target=_blank id="L67" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L67" rel="#L67" style="color: rgb(102, 102, 102); text-decoration: none;"> 67</a> <a target=_blank id="L68" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L68" rel="#L68" style="color: rgb(102, 102, 102); text-decoration: none;"> 68</a> <a target=_blank id="L69" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L69" rel="#L69" style="color: rgb(102, 102, 102); text-decoration: none;"> 69</a> <a target=_blank id="L70" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L70" rel="#L70" style="color: rgb(102, 102, 102); text-decoration: none;"> 70</a> <a target=_blank id="L71" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L71" rel="#L71" style="color: rgb(102, 102, 102); text-decoration: none;"> 71</a> <a target=_blank id="L72" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L72" rel="#L72" style="color: rgb(102, 102, 102); text-decoration: none;"> 72</a> <a target=_blank id="L73" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L73" rel="#L73" style="color: rgb(102, 102, 102); text-decoration: none;"> 73</a> <a target=_blank id="L74" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L74" rel="#L74" style="color: rgb(102, 102, 102); text-decoration: none;"> 74</a> <a target=_blank id="L75" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L75" rel="#L75" style="color: rgb(102, 102, 102); text-decoration: none;"> 75</a> <a target=_blank id="L76" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L76" rel="#L76" style="color: rgb(102, 102, 102); text-decoration: none;"> 76</a> <a target=_blank id="L77" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L77" rel="#L77" style="color: rgb(102, 102, 102); text-decoration: none;"> 77</a> <a target=_blank id="L78" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L78" rel="#L78" style="color: rgb(102, 102, 102); text-decoration: none;"> 78</a> <a target=_blank id="L79" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L79" rel="#L79" style="color: rgb(102, 102, 102); text-decoration: none;"> 79</a> <a target=_blank id="L80" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L80" rel="#L80" style="color: rgb(102, 102, 102); text-decoration: none;"> 80</a> <a target=_blank id="L81" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L81" rel="#L81" style="color: rgb(102, 102, 102); text-decoration: none;"> 81</a> <a target=_blank id="L82" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L82" rel="#L82" style="color: rgb(102, 102, 102); text-decoration: none;"> 82</a> <a target=_blank id="L83" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L83" rel="#L83" style="color: rgb(102, 102, 102); text-decoration: none;"> 83</a> <a target=_blank id="L84" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L84" rel="#L84" style="color: rgb(102, 102, 102); text-decoration: none;"> 84</a> <a target=_blank id="L85" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L85" rel="#L85" style="color: rgb(102, 102, 102); text-decoration: none;"> 85</a> <a target=_blank id="L86" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L86" rel="#L86" style="color: rgb(102, 102, 102); text-decoration: none;"> 86</a> <a target=_blank id="L87" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L87" rel="#L87" style="color: rgb(102, 102, 102); text-decoration: none;"> 87</a> <a target=_blank id="L88" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L88" rel="#L88" style="color: rgb(102, 102, 102); text-decoration: none;"> 88</a> <a target=_blank id="L89" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L89" rel="#L89" style="color: rgb(102, 102, 102); text-decoration: none;"> 89</a> <a target=_blank id="L90" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L90" rel="#L90" style="color: rgb(102, 102, 102); text-decoration: none;"> 90</a> <a target=_blank id="L91" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L91" rel="#L91" style="color: rgb(102, 102, 102); text-decoration: none;"> 91</a> <a target=_blank id="L92" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L92" rel="#L92" style="color: rgb(102, 102, 102); text-decoration: none;"> 92</a> <a target=_blank id="L93" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L93" rel="#L93" style="color: rgb(102, 102, 102); text-decoration: none;"> 93</a> <a target=_blank id="L94" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L94" rel="#L94" style="color: rgb(102, 102, 102); text-decoration: none;"> 94</a> <a target=_blank id="L95" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L95" rel="#L95" style="color: rgb(102, 102, 102); text-decoration: none;"> 95</a> <a target=_blank id="L96" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L96" rel="#L96" style="color: rgb(102, 102, 102); text-decoration: none;"> 96</a> <a target=_blank id="L97" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L97" rel="#L97" style="color: rgb(102, 102, 102); text-decoration: none;"> 97</a> <a target=_blank id="L98" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L98" rel="#L98" style="color: rgb(102, 102, 102); text-decoration: none;"> 98</a> <a target=_blank id="L99" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L99" rel="#L99" style="color: rgb(102, 102, 102); text-decoration: none;"> 99</a> <a target=_blank id="L100" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L100" rel="#L100" style="color: rgb(102, 102, 102); text-decoration: none;"> 100</a> <a target=_blank id="L101" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L101" rel="#L101" style="color: rgb(102, 102, 102); text-decoration: none;"> 101</a> <a target=_blank id="L102" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L102" rel="#L102" style="color: rgb(102, 102, 102); text-decoration: none;"> 102</a> <a target=_blank id="L103" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L103" rel="#L103" style="color: rgb(102, 102, 102); text-decoration: none;"> 103</a> <a target=_blank id="L104" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L104" rel="#L104" style="color: rgb(102, 102, 102); text-decoration: none;"> 104</a> <a target=_blank id="L105" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L105" rel="#L105" style="color: rgb(102, 102, 102); text-decoration: none;"> 105</a> <a target=_blank id="L106" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L106" rel="#L106" style="color: rgb(102, 102, 102); text-decoration: none;"> 106</a> <a target=_blank id="L107" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L107" rel="#L107" style="color: rgb(102, 102, 102); text-decoration: none;"> 107</a> <a target=_blank id="L108" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L108" rel="#L108" style="color: rgb(102, 102, 102); text-decoration: none;"> 108</a> <a target=_blank id="L109" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L109" rel="#L109" style="color: rgb(102, 102, 102); text-decoration: none;"> 109</a> <a target=_blank id="L110" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L110" rel="#L110" style="color: rgb(102, 102, 102); text-decoration: none;"> 110</a> <a target=_blank id="L111" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L111" rel="#L111" style="color: rgb(102, 102, 102); text-decoration: none;"> 111</a> <a target=_blank id="L112" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L112" rel="#L112" style="color: rgb(102, 102, 102); text-decoration: none;"> 112</a> <a target=_blank id="L113" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L113" rel="#L113" style="color: rgb(102, 102, 102); text-decoration: none;"> 113</a> <a target=_blank id="L114" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L114" rel="#L114" style="color: rgb(102, 102, 102); text-decoration: none;"> 114</a> <a target=_blank id="L115" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L115" rel="#L115" style="color: rgb(102, 102, 102); text-decoration: none;"> 115</a> <a target=_blank id="L116" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L116" rel="#L116" style="color: rgb(102, 102, 102); text-decoration: none;"> 116</a> <a target=_blank id="L117" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L117" rel="#L117" style="color: rgb(102, 102, 102); text-decoration: none;"> 117</a> <a target=_blank id="L118" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L118" rel="#L118" style="color: rgb(102, 102, 102); text-decoration: none;"> 118</a> <a target=_blank id="L119" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L119" rel="#L119" style="color: rgb(102, 102, 102); text-decoration: none;"> 119</a> <a target=_blank id="L120" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L120" rel="#L120" style="color: rgb(102, 102, 102); text-decoration: none;"> 120</a> <a target=_blank id="L121" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L121" rel="#L121" style="color: rgb(102, 102, 102); text-decoration: none;"> 121</a> <a target=_blank id="L122" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L122" rel="#L122" style="color: rgb(102, 102, 102); text-decoration: none;"> 122</a> <a target=_blank id="L123" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L123" rel="#L123" style="color: rgb(102, 102, 102); text-decoration: none;"> 123</a> <a target=_blank id="L124" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L124" rel="#L124" style="color: rgb(102, 102, 102); text-decoration: none;"> 124</a> <a target=_blank id="L125" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L125" rel="#L125" style="color: rgb(102, 102, 102); text-decoration: none;"> 125</a> <a target=_blank id="L126" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L126" rel="#L126" style="color: rgb(102, 102, 102); text-decoration: none;"> 126</a> <a target=_blank id="L127" href="http://blog.csdn.net/nugongahou110/article/details/46910149#L127" rel="#L127" style="color: rgb(102, 102, 102); text-decoration: none;"> 127</a> | package info.androidhive.customlistviewvolley; import info.androidhive.customlistviewvolley.adater.CustomListAdapter;import info.androidhive.customlistviewvolley.app.AppController;import info.androidhive.customlistviewvolley.model.Movie; import java.util.ArrayList;import java.util.List; import org.json.JSONArray;import org.json.JSONException;import org.json.JSONObject; import android.app.Activity;import android.app.ProgressDialog;import android.graphics.Color;import android.graphics.drawable.ColorDrawable;import android.os.Bundle;import android.util.Log;import android.view.Menu;import android.widget.ListView; import com.android.volley.Response;import com.android.volley.VolleyError;import com.android.volley.VolleyLog;import com.android.volley.toolbox.JsonArrayRequest; public class MainActivity extends Activity { // 用來打Log日志的TAG private static final String TAG = MainActivity.class.getSimpleName(); // JSON地址 private static final String url = "http://api.androidhive.info/json/movies.json"; private ProgressDialog pDialog; //用來存儲Movie對象的list private List<Movie> movieList = new ArrayList<Movie>(); private ListView listView; private CustomListAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listView = (ListView) findViewById(R.id.list); adapter = new CustomListAdapter(this, movieList); listView.setAdapter(adapter); pDialog = new ProgressDialog(this); // 加載框 pDialog.setMessage("Loading..."); pDialog.show(); // 發送一個Json請求 JsonArrayRequest movieReq = new JsonArrayRequest(url, new Response.Listener<JSONArray>() { @Override public void onResponse(JSONArray response) { Log.d(TAG, response.toString()); hidePDialog(); // 解析json數據 for (int i = 0; i < response.length(); i++) { try { JSONObject obj = response.getJSONObject(i); Movie movie = new Movie(); movie.setTitle(obj.getString("title")); movie.setThumbnailUrl(obj.getString("image")); movie.setRating(((Number) obj.get("rating")) .doubleValue()); movie.setYear(obj.getInt("releaseYear")); // Genre是一個json數組 JSONArray genreArry = obj.getJSONArray("genre"); ArrayList<String> genre = new ArrayList<String>(); for (int j = 0; j < genreArry.length(); j++) { genre.add((String) genreArry.get(j)); } movie.setGenre(genre); // 將解析好的一個movie對象添加到list中 movieList.add(movie); } catch (JSONException e) { e.printStackTrace(); } } // 通知listview我們的數據已經改變,現在更新 adapter.notifyDataSetChanged(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { VolleyLog.d(TAG, "Error: " + error.getMessage()); hidePDialog(); } }); // 將request添加到requestQueue中 AppController.getInstance().addToRequestQueue(movieReq); } @Override public void onDestroy() { super.onDestroy(); hidePDialog(); } private void hidePDialog() { if (pDialog != null) { pDialog.dismiss(); pDialog = null; } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } } |
總結
以上是生活随笔為你收集整理的Android网络框架-Volley实践 使用Volley打造自定义ListView的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 最新变态传奇android,新开超级变态
- 下一篇: 腾讯云“黑石”真相——“物理私服”