<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.Service.BusActivity">
<!--在我们的这个位置的话就是设置我们的相关的方法-->
<ExpandableListView
android:id="@+id/ExpandableListView"
android:layout_marginTop="10dp"
android:groupIndicator="@null"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
然后的话就是设置我们的相关的方法:
package com.example.smartcitymodel.ui.Service;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ExpandableListView;
import com.example.smartcitymodel.R;
import com.example.smartcitymodel.ui.Bean.BusLineBean;
import com.example.smartcitymodel.ui.Bean.BusStopBean;
import com.example.smartcitymodel.ui.Utils.HttpUtil;
import com.example.smartcitymodel.ui.Utils.MyApplication;
import com.example.smartcitymodel.ui.Utils.OkHttpCallBack;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class BusActivity extends AppCompatActivity {
private android.widget.ExpandableListView ExpandableListView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bus);
/*
* 在我们的这个位置的话就是设置我们的相关的方法 *
* */
initView();
/*
*
* 在我们的这个位置的话就是设置我们的相关的数据
* */
getData();
}
private void getData() {
/*
* 在我们的这个位置的话编写我们的相关的网络请求
* */
HttpUtil.getInstance().doGet("/userinfo/lines/list", new OkHttpCallBack() {
@Override
public void successful(String successString) throws IOException {
/*
* 在我们的这个位置的话解析我们的相关的数据
* */
BusLineBean busLineBean = MyApplication.getGson().fromJson(successString,BusLineBean.class);
/*
* 在我们的这个位置创建我们的列表存储我们的相关的数据
* */
final List<BusLineBean.RowsBean> lines = busLineBean.getRows();
/*
* 在我们的这个位置的话设置我们的相关的方法然后的话将我们的数据添加进去
* */
List<Integer> datas = lines.stream().map(BusLineBean.RowsBean::getId).collect(Collectors.toList());
/*
* 在我们的这个位置的话就是设置我们的相关的方法,将我们的数据传入这个东西
* */
getChildData(datas,lines);
}
private void getChildData(List<Integer> datas, List<BusLineBean.RowsBean> lines) {
ArrayList<BusStopBean> busStop = new ArrayList<>();
for(Integer data : datas){
HttpUtil.getInstance().doGet("/userinfo/busStop/list", new OkHttpCallBack() {
@Override
public void successful(String successString) throws IOException {
BusStopBean busStopBean = MyApplication.getGson().fromJson(successString,BusStopBean.class);
busStop.add(busStopBean);
if(datas.size() == busStop.size()){
runOnUiThread(new Runnable() {
@Override
public void run() {
ExpandableListView.setAdapter(new MyExpanableAdapter(lines,busStop));
}
});
}
}
@Override
public void onFailure(String errorString) {
}
});
}
}
@Override
public void onFailure(String errorString) {
}
});
}
private void initView() {
ExpandableListView = (ExpandableListView) findViewById(R.id.ExpandableListView);
/*
* 在我们的这个位置的话就是设置我们的相关的方法然后的话就是设置我们的相关的网络请求
* */
}
}
然后的话就是设置我们的相关的数据适配器的代码:
package com.example.smartcitymodel.ui.Service;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.constraintlayout.solver.widgets.Guideline;
import com.example.smartcitymodel.R;
import com.example.smartcitymodel.ui.Bean.BusLineBean;
import com.example.smartcitymodel.ui.Bean.BusStopBean;
import java.util.ArrayList;
import java.util.List;
// todo 在我们的这个位置的话就是创建我们的相关的适配器
public class MyExpanableAdapter extends BaseExpandableListAdapter {
private List<BusLineBean.RowsBean> bustListLineBeans;
private List<BusStopBean> busStopBeans;
public MyExpanableAdapter(List<BusLineBean.RowsBean> bustListLineBeans, ArrayList<BusStopBean> busStopBeans) {
this.bustListLineBeans = bustListLineBeans;
this.busStopBeans = busStopBeans;
}
@Override
public int getGroupCount() {
return bustListLineBeans.size();
}
@Override
public int getChildrenCount(int i) {
return busStopBeans.get(i).getRows().size();
}
@Override
public Object getGroup(int i) {
return busStopBeans.get(i);
}
@Override
public Object getChild(int i, int i1) {
return busStopBeans.get(i).getRows().get(i1);
}
@Override
public long getGroupId(int i) {
return i;
}
@Override
public long getChildId(int i, int i1) {
return i1;
}
@Override
public boolean hasStableIds() {
return false;
}
// 在我们的这个位置的话就是设置我们的相关的方法
@Override
public View getGroupView(int i, boolean b, View view, ViewGroup viewGroup) {
// todo 在我们的这个位置的话就是设置我们的相关的方法然后的话就是设置我们的数据的绑定
ParentViewHolder viewholder;
if(view == null){
view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.layout_expanable_parent,viewGroup,false);
// 在我们的这个位置的话创建我们的holder
viewholder = new ParentViewHolder();
viewholder. flBusDetail = view.findViewById(R.id.fl_bus_detail);
viewholder. btnRoad = view.findViewById(R.id.btn_road);
viewholder. tvUserName = view.findViewById(R.id.tv_user_name);
viewholder. tvMiles = view.findViewById(R.id.tv_miles);
viewholder. tvEndspot = view.findViewById(R.id.tv_endspot);
viewholder. tvMoney = view.findViewById(R.id.tv_money);
viewholder. view3 = view.findViewById(R.id.view3);
// viewholder. guideline7 = view.findViewById(R.id.guideline7);
viewholder. imageView6 = view.findViewById(R.id.imageView6);
view.setTag(viewholder);
}else {
viewholder = ((ParentViewHolder) view.getTag());
}
instantiateView(viewholder,i);
if(b){
viewholder.imageView6.setImageResource(R.drawable.ic_baseline_keyboard_arrow_down_24);
}else {
viewholder.imageView6.setImageResource(R.drawable.ic_baseline_keyboard_arrow_right_24);
}
return view;
}
/*
* 在我们的这个位置的话就是实例化我们的控件
*
* */
private void instantiateView(ParentViewHolder viewholder, int i) {
BusLineBean.RowsBean rows = bustListLineBeans.get(i);
// 然后的话在我们的这个位置的话设置我们的相关的文本
viewholder.tvUserName.setText(String.format("起点:%s",rows.getFirst()));
viewholder.tvEndspot.setText(String.format("终点:%s",rows.getEnd()));
viewholder.tvMiles.setText(String.format("里程:%s公里",rows.getMileage()));
viewholder.tvMoney.setText(String.format("票价:%s元",rows.getPrice()));
viewholder.btnRoad.setText(rows.getName());
viewholder.flBusDetail.setOnClickListener(view -> {
// 在我们的这个位置的话就是设置我们的点击事件
Context context = viewholder.btnRoad.getContext();
Intent intent = new Intent(context,BusDetailActivity.class);
intent.putExtra("busId",rows.getId());
context.startActivity(intent);
});
}
@Override
public View getChildView(int i, int i1, boolean b, View view, ViewGroup viewGroup) {
ChildViewdHolder viewHolder;
if(view == null){
view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.layout_eapanable_child,viewGroup,false);
viewHolder = new ChildViewdHolder();
viewHolder.textView9 = view.findViewById(R.id.textView9);
viewHolder.tvSppotInfo = view.findViewById(R.id.tv_sppot_info);
view.setTag(viewHolder);
}else{
viewHolder = ((ChildViewdHolder) view.getTag());
}
// 在我们的这个位置的话设置我们的相关的方法
instantiateChildView(viewHolder,i,i1,b);
return view;
}
/*
* 在我们的这个位置的代码有点问题
*
* */
private void instantiateChildView(ChildViewdHolder viewdHolder,int i,int i1,boolean b){
BusStopBean.RowsBean rowsBean = busStopBeans.get(i).getRows().get(i1);
if(i1 == 0){
viewdHolder.textView9.setText("起点");
}else if(b){
viewdHolder.textView9.setText("终点");
}else{
viewdHolder.textView9.setText("");
}
viewdHolder.tvSppotInfo.setText(rowsBean.getName());
}
@Override
public boolean isChildSelectable(int i, int i1) {
return true;
}
private class ParentViewHolder {
private FrameLayout flBusDetail;
private TextView btnRoad;
private TextView tvUserName;
private TextView tvMiles;
private TextView tvEndspot;
private TextView tvMoney;
private View view3;
private Guideline guideline7;
private ImageView imageView6;
}
/*
*
* 在我们的在这个位置的话就是设置我们的相关的成员变量
* */
private class ChildViewdHolder {
private TextView textView9;
private TextView tvSppotInfo;
}
}
然后的话在我们的这个位置的话就是设置我们的相关的方法:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto">
<!--在我们的这个位置的话就是设置我们的相关的方法-->
<FrameLayout
android:id="@+id/fl_bus_detail"
app:layout_constraintBottom_toTopOf="@+id/tv_user_name"
app:layout_constraintStart_toStartOf="parent"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--这个位置的话就是设置我们的相关的方法-->
<TextView
android:background="#519DDA"
android:id="@+id/btn_road"
android:text="一号线"
android:backgroundTint="@color/teal_200"
android:layout_margin="8dp"
android:paddingTop="6dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:paddingBottom="6dp"
android:textColor="@color/white"
android:textSize="16sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</FrameLayout>
<!--然后的话在我们的这个位置的话就是设置我们的相关的文本信息-->
<TextView
app:layout_constraintTop_toBottomOf="@+id/view3"
app:layout_constraintStart_toStartOf="parent"
android:textSize="18sp"
android:id="@+id/tv_user_name"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="起始站:北京站"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<!--在我们的这个位置的话就是设置我们的相关的路程-->
<TextView
android:id="@+id/tv_miles"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:padding="8dp"
android:text="里程:20公里"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/tv_user_name"
app:layout_constraintTop_toBottomOf="@+id/tv_user_name" />
<TextView
android:id="@+id/tv_endspot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:text="终点站:南京站"
android:textSize="18sp"
app:layout_constraintEnd_toStartOf="@+id/imageView6"
app:layout_constraintTop_toBottomOf="@+id/view3" />
<TextView
android:id="@+id/tv_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:padding="8dp"
android:text="票价:8元"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/tv_endspot"
app:layout_constraintTop_toBottomOf="@+id/tv_endspot"
app:layout_constraintVertical_bias="0.0" />
<View
android:id="@+id/view3"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="8dp"
android:background="?attr/colorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/fl_bus_detail"/>
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_begin="205dp" />
<ImageView
android:id="@+id/imageView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/view3"
app:srcCompat="@drawable/ic_baseline_keyboard_arrow_right_24" />
</androidx.constraintlayout.widget.ConstraintLayout>
以上的话是我们的其中一个的适配器模板:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto">
<!--在我们的这个位置的话就是设置我们的相关的fragmentlayout-->
<FrameLayout
app:layout_constraintStart_toStartOf="parent"
android:id="@+id/fl_bus_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="MissingConstraints" >
<!--在我们的这个位置的话就是设置我们的相关的东西-->
<TextView
android:textSize="18sp"
android:id="@+id/btn_road"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:background="#1FDC26"
android:paddingStart="16dp"
android:paddingTop="6dp"
android:paddingEnd="16dp"
android:paddingBottom="6dp"
android:text="一号线"
android:textColor="@color/white"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="16dp"
tools:ignore="MissingConstraints" />
</FrameLayout>
<!--在我们的这个位置的话就是设置我们的相关的方法-->
<TextView
android:id="@+id/tv_user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="起始站:北京站"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="43dp"
tools:layout_editor_absoluteY="73dp" />
<TextView
android:id="@+id/tv_miles"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="里程:20公里"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="43dp"
tools:layout_editor_absoluteY="137dp" />
<TextView
android:id="@+id/tv_endspot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="终点站:南京站"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="226dp"
tools:layout_editor_absoluteY="73dp" />
<TextView
android:id="@+id/tv_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="票价:8元"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="234dp"
tools:layout_editor_absoluteY="137dp" />
<View
android:id="@+id/view3"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="8dp"
android:background="?attr/colorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/fl_bus_detail"/>
<androidx.constraintlayout.widget.Guideline
android:layout_width="wrap_content"
android:id="@+id/guideline7"
android:orientation="vertical"
app:layout_constraintGuide_begin="205dp"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/imageView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/view3"
app:srcCompat="@drawable/ic_baseline_keyboard_arrow_right_24" />
</androidx.constraintlayout.widget.ConstraintLayout>
然后的话在我们的这个位置的话就是设置我们的相关的方法:
第一个json格式的数据BusStopBean:
package com.example.smartcitymodel.ui.Bean;
import com.google.gson.Gson;
import java.util.List;
public class BusStopBean {
/**
* total : 27
* rows : [{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"1","stepsId":"1","name":"光谷金融街","sequence":"1"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"1","stepsId":"2","name":"解放路","sequence":"2"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"1","stepsId":"3","name":"西安路","sequence":"3"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"1","stepsId":"4","name":"南湖大厦","sequence":"4"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"2","stepsId":"1","name":"光谷金融街","sequence":"1"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"2","stepsId":"3","name":"西安路","sequence":"2"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"2","stepsId":"4","name":"南湖大厦","sequence":"3"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"2","stepsId":"6","name":"万达广场","sequence":"4"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"3","stepsId":"21","name":"香炉礁站","sequence":"1"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"3","stepsId":"22","name":"金家街站","sequence":"2"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"3","stepsId":"23","name":"泉水站","sequence":"3"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"3","stepsId":"24","name":"后盐站","sequence":"4"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"3","stepsId":"25","name":"大连湾站","sequence":"5"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"3","stepsId":"26","name":"金马路站","sequence":"6"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"3","stepsId":"27","name":"开发区站","sequence":"7"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"3","stepsId":"28","name":"保税区站","sequence":"8"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"3","stepsId":"29","name":"双D港站","sequence":"9"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"3","stepsId":"30","name":"小窑湾站","sequence":"10"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"3","stepsId":"31","name":"金石滩站","sequence":"11"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"4","stepsId":"32","name":"河口站","sequence":"1"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"4","stepsId":"33","name":"蔡大岭站","sequence":"2"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"4","stepsId":"34","name":"黄泥川站","sequence":"3"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"4","stepsId":"35","name":"龙王塘站","sequence":"4"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"4","stepsId":"36","name":"塔河湾站","sequence":"5"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"4","stepsId":"37","name":"旅顺站","sequence":"6"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"4","stepsId":"38","name":"铁山站","sequence":"7"},{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"linesId":"4","stepsId":"39","name":"旅顺新港站","sequence":"8"}]
* code : 200
* msg : 查询成功
*/
private int total;
private int code;
private String msg;
private List<RowsBean> rows;
public static BusStopBean objectFromData(String str) {
return new Gson().fromJson(str, BusStopBean.class);
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public List<RowsBean> getRows() {
return rows;
}
public void setRows(List<RowsBean> rows) {
this.rows = rows;
}
public static class RowsBean {
/**
* searchValue : null
* createBy : null
* createTime : null
* updateBy : null
* updateTime : null
* remark : null
* params : {}
* linesId : 1
* stepsId : 1
* name : 光谷金融街
* sequence : 1
*/
private Object searchValue;
private Object createBy;
private Object createTime;
private Object updateBy;
private Object updateTime;
private Object remark;
private ParamsBean params;
private String linesId;
private String stepsId;
private String name;
private String sequence;
public static RowsBean objectFromData(String str) {
return new Gson().fromJson(str, RowsBean.class);
}
public Object getSearchValue() {
return searchValue;
}
public void setSearchValue(Object searchValue) {
this.searchValue = searchValue;
}
public Object getCreateBy() {
return createBy;
}
public void setCreateBy(Object createBy) {
this.createBy = createBy;
}
public Object getCreateTime() {
return createTime;
}
public void setCreateTime(Object createTime) {
this.createTime = createTime;
}
public Object getUpdateBy() {
return updateBy;
}
public void setUpdateBy(Object updateBy) {
this.updateBy = updateBy;
}
public Object getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Object updateTime) {
this.updateTime = updateTime;
}
public Object getRemark() {
return remark;
}
public void setRemark(Object remark) {
this.remark = remark;
}
public ParamsBean getParams() {
return params;
}
public void setParams(ParamsBean params) {
this.params = params;
}
public String getLinesId() {
return linesId;
}
public void setLinesId(String linesId) {
this.linesId = linesId;
}
public String getStepsId() {
return stepsId;
}
public void setStepsId(String stepsId) {
this.stepsId = stepsId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSequence() {
return sequence;
}
public void setSequence(String sequence) {
this.sequence = sequence;
}
public static class ParamsBean {
public static ParamsBean objectFromData(String str) {
return new Gson().fromJson(str, ParamsBean.class);
}
}
}
}
第二个json格式的数据:BusLineBean
package com.example.smartcitymodel.ui.Bean;
import com.google.gson.Gson;
import java.util.List;
public class BusLineBean {
/**
* total : 4
* rows : [{"searchValue":null,"createBy":null,"createTime":"2020-10-05 11:23:32","updateBy":null,"updateTime":"2020-10-21 11:23:35","remark":null,"endTime":"19:45","params":{},"id":1,"name":"一号线","first":"光谷金融街","end":"南湖大厦","startTime":"6:30","price":8,"mileage":"20"},{"searchValue":null,"createBy":null,"createTime":"2020-10-13 12:28:57","updateBy":null,"updateTime":"2020-10-22 12:29:00","remark":null,"endTime":"21:45","params":{},"id":2,"name":"二号线","first":"光谷金融街","end":"万达广场","startTime":"6:30","price":8,"mileage":"22"},{"searchValue":null,"createBy":null,"createTime":"2020-10-27 16:57:07","updateBy":null,"updateTime":"2020-10-27 16:57:21","remark":null,"endTime":"22:00","params":{},"id":3,"name":"三号线","first":"香炉礁","end":"金石沙滩","startTime":"6:30","price":9,"mileage":"30"},{"searchValue":null,"createBy":null,"createTime":"2020-10-27 16:59:03","updateBy":null,"updateTime":"2020-10-27 16:59:06","remark":null,"endTime":"23:00","params":{},"id":4,"name":"十二号线","first":"河口","end":"辛寨子","startTime":"5:30","price":12,"mileage":"40"}]
* code : 200
* msg : 查询成功
*/
private int total;
private int code;
private String msg;
private List<RowsBean> rows;
public static BusLineBean objectFromData(String str) {
return new Gson().fromJson(str, BusLineBean.class);
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public List<RowsBean> getRows() {
return rows;
}
public void setRows(List<RowsBean> rows) {
this.rows = rows;
}
public static class RowsBean {
/**
* searchValue : null
* createBy : null
* createTime : 2020-10-05 11:23:32
* updateBy : null
* updateTime : 2020-10-21 11:23:35
* remark : null
* endTime : 19:45
* params : {}
* id : 1
* name : 一号线
* first : 光谷金融街
* end : 南湖大厦
* startTime : 6:30
* price : 8
* mileage : 20
*/
private Object searchValue;
private Object createBy;
private String createTime;
private Object updateBy;
private String updateTime;
private Object remark;
private String endTime;
private ParamsBean params;
private int id;
private String name;
private String first;
private String end;
private String startTime;
private int price;
private String mileage;
public static RowsBean objectFromData(String str) {
return new Gson().fromJson(str, RowsBean.class);
}
public Object getSearchValue() {
return searchValue;
}
public void setSearchValue(Object searchValue) {
this.searchValue = searchValue;
}
public Object getCreateBy() {
return createBy;
}
public void setCreateBy(Object createBy) {
this.createBy = createBy;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public Object getUpdateBy() {
return updateBy;
}
public void setUpdateBy(Object updateBy) {
this.updateBy = updateBy;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public Object getRemark() {
return remark;
}
public void setRemark(Object remark) {
this.remark = remark;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public ParamsBean getParams() {
return params;
}
public void setParams(ParamsBean params) {
this.params = params;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFirst() {
return first;
}
public void setFirst(String first) {
this.first = first;
}
public String getEnd() {
return end;
}
public void setEnd(String end) {
this.end = end;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getMileage() {
return mileage;
}
public void setMileage(String mileage) {
this.mileage = mileage;
}
public static class ParamsBean {
public static ParamsBean objectFromData(String str) {
return new Gson().fromJson(str, ParamsBean.class);
}
}
}
}
还有的话就是我们的两个图标文件的数据: