public class MyAdapter1 extends BaseAdapter {
private List<MyData.DataBean> list;
private Context context;
public MyAdapter1(List<MyData.DataBean> list, Context context) {
this.list = list;
this.context = context;
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int position) {
return list.get(position);
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = View.inflate(context, R.layout.item, null);
//holder.image = convertView.findViewById(R.id.image2);
holder.name = convertView.findViewById(R.id.tu1);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.name.setText(list.get(position).getNews_title());
//ImageLoader.getInstance().displayImage(list.get(position).getPic_url(), holder.image);
return convertView;
}
class ViewHolder {
TextView name;
//ImageView image;
}