输入数据后,我正在使用基本适配器实现自定义列表视图,我的列表不会自动刷新。我需要重新打开片段才能看到更新。
public class Lead_Adapter extends BaseAdapter {
private Context context;
private ArrayList<Lead_Model> leadarrayList;
public Lead_Adapter(Context context,ArrayList<Lead_Model>arrayList){
this.context = context;
this.leadarrayList = arrayList;
}
@Override
public int getCount() {
return this.leadarrayList.size();
}
@Override
public Object getItem(int position) {
return leadarrayList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convert_view, ViewGroup parent) {
LayoutInflater layoutInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convert_view = layoutInflater.inflate(R.layout.lead_listview, null);
TextView Company_Name = convert_view.findViewById(R.id.company_name_listview);
TextView Lead_Status = convert_view.findViewById(R.id.lead_status_listview);
TextView Lead_Date = convert_view.findViewById(R.id.lead_date_listview);
Lead_Model leadModel = leadarrayList.get(position);
Company_Name.setText(leadModel.getCompany_name());
Lead_Status.setText(leadModel.getLead_status());
Lead_Date.setText(leadModel.getDate());
return convert_view;
}
繁星coding
温温酱
狐的传说
小唯快跑啊
相关分类