zoukankan      html  css  js  c++  java
  • JAVA日报

    从零开始的体温app开发(adapter1)

    package adapter;

    import android.content.Context;
    import android.util.Log;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.BaseAdapter;
    import android.widget.TextView;

    import com.example.myapplication.R;

    import java.util.List;

    import bean.User;

    public class UserListAdapter extends BaseAdapter {
    private final Context context;
    private final List<User> userList;
    public UserListAdapter(Context context, List<User> userList) {
    this.context=context;
    this.userList=userList;
    }

    @Override
    public int getCount() {
    return userList.size();
    }

    @Override
    public Object getItem(int i) {
    return userList.get(i);
    }

    @Override
    public long getItemId(int i) {
    return 0;
    }

    @Override
    public View getView(int i, View convertView, ViewGroup parent) {
    if(convertView==null){
    convertView=View.inflate(context,R.layout.item_user,null);
    }
    TextView num= convertView.findViewById(R.id.num);
    TextView name= convertView.findViewById(R.id.name);
    TextView cl= convertView.findViewById(R.id.cl);
    TextView data= convertView.findViewById(R.id.date);
    TextView time= convertView.findViewById(R.id.time);
    TextView area= convertView.findViewById(R.id.area);
    TextView tem= convertView.findViewById(R.id.tem);
    TextView es= convertView.findViewById(R.id.es);
    num.setText(userList.get(i).get("num"));
    name.setText(userList.get(i).get("name"));
    cl.setText(userList.get(i).get("cl"));
    data.setText(userList.get(i).get("date"));
    time.setText(userList.get(i).get("time"));
    area.setText(userList.get(i).get("area"));
    tem.setText(userList.get(i).get("tem"));
    es.setText(userList.get(i).get("qw"));
    //Log.e("position",""+i+userList.get(i).get("num"));
    return convertView;
    }
    }
  • 相关阅读:
    MVC中使用AuthorizeAttribute做身份验证操作
    Entity Framework 5.0 Code First全面学习
    AngularJs学习教程
    安装完Oracle数据库,给scott账户解锁方法
    Signalr学习教程
    javascript学习教程【Qi Fei】
    并行开发
    MongoDB教程【一】
    统计学习概念
    自学Python的点滴
  • 原文地址:https://www.cnblogs.com/mumulailai/p/14909364.html
Copyright © 2011-2022 走看看