endian11
2020-08-13 a927c72c0f06ef5bd771e5ae00bc35155c271762
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package safeluck.drive.evaluation.adapter;
 
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
 
import java.util.ArrayList;
import java.util.List;
 
import safeluck.drive.evaluation.R;
 
/**
 * MyApplication2
 * Created by lzw on 2020/1/10. 16:33:13
 * 邮箱:632393724@qq.com
 * All Rights Saved! Chongqing AnYun Tech co. LTD
 */
 
public class GpsInfoAdapter extends BaseAdapter {
    private List<String> persons = new ArrayList<>();//gps信息
    private final static String TAG = "anyun_info";
    private Context mContext;
    @Override
    public int getCount() {
        return persons.size();
    }
 
    @Override
    public String getItem(int i) {
        return persons.get(i);
    }
 
    @Override
    public long getItemId(int i) {
        return i;
    }
 
    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        InfoHodler infoHodler = null;
        if (view == null){
            view = LayoutInflater.from(mContext).inflate(R.layout.gps_info_item,null);
            infoHodler = new InfoHodler();
            infoHodler.name = view.findViewById(R.id.text_check_info);
            view.setTag(infoHodler);
        }else{
            infoHodler = (InfoHodler) view.getTag();
        }
 
        infoHodler.name.setText(getItem(i));
        return view;
    }
 
    public GpsInfoAdapter(Context mContext) {
        this.mContext = mContext;
    }
    /**
     * //先清掉原来的所有数据再添加新加进来所有的数据
     * @param ps
     */
    public void addAll(List<String> ps){
        persons.clear();//先清掉原来的所有数据
        persons.addAll(ps);//再添加新加进来所有的数据
        notifyDataSetChanged();//刷新界面
    }
 
    static class InfoHodler {
 
 
        public TextView name;//姓名
 
 
 
 
 
    }
 
}