国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > Android > 正文

Android之解析JSON數據示例(android原生態(tài),FastJson,Gson)

2019-12-12 03:34:21
字體:
來源:轉載
供稿:網友

1.json網頁代碼

<%@ page language="java" contentType="text/plain; charset=UTF-8" pageEncoding="UTF-8"%><%@page isELIgnored="false" %>${fqs }

2.json數據網頁效果圖

3.Android代碼

布局

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <Button  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="獲取JSON數據"  android:onClick="getJSON"/> <ListView  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:id="@+id/lv_json_main"></ListView></LinearLayout><?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main_fastjson" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <Button  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="獲取JSON數據fastjson"  android:onClick="getFastjson"/> <ListView  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:id="@+id/lv_fastjson_main"></ListView></LinearLayout><?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main_gson" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <Button  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="獲取JSON數據Gson"  android:onClick="getGSON"/> <ListView  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:id="@+id/lv_gson_main"></ListView></LinearLayout><?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <TextView  android:layout_width="0dp"  android:layout_height="wrap_content"  android:id="@+id/tv_item_listview_name"  android:layout_weight="1"/> <TextView  android:layout_width="0dp"  android:layout_height="wrap_content"  android:id="@+id/tv_item_listview_content"  android:layout_weight="1"/> <TextView  android:layout_width="0dp"  android:layout_height="wrap_content"  android:id="@+id/tv_item_listview_time"  android:layout_weight="1"/></LinearLayout>

Android原生態(tài)代碼解析

public class MainActivity extends AppCompatActivity { private ListView lv_json_main; private List<FQ> fqs = new ArrayList<>(); private MyAdapter myadapter; private ProgressDialog progressDialog; @Override protected void onCreate(Bundle savedInstanceState) {  super.onCreate(savedInstanceState);  setContentView(R.layout.activity_main);  lv_json_main = (ListView) findViewById(R.id.lv_json_main);  myadapter = new MyAdapter();  lv_json_main.setAdapter(myadapter);  progressDialog = new ProgressDialog(this);  progressDialog.setMessage("小青正在拼命加

主站蜘蛛池模板:
龙山县|
池州市|
武威市|
新巴尔虎左旗|
城步|
普安县|
图片|
慈利县|
武强县|
邵东县|
宁陵县|
犍为县|
大安市|
迁西县|
潞城市|
和田市|
牟定县|
新泰市|
石门县|
怀柔区|
特克斯县|
绥江县|
武冈市|
乌拉特前旗|
梁平县|
怀远县|
双柏县|
太保市|
连州市|
瓦房店市|
十堰市|
龙州县|
徐州市|
苏州市|
门源|
汤原县|
教育|
尤溪县|
孟村|
阜南县|
元朗区|