我有一个ListView
. 我已经使用ArrayAdapter
. 所有数据都来自后端。当我单击列表项时,我将导航到详细信息屏幕。
设想:
经理有一份他/她的报告人提出的休假请求清单。当经理选择请假请求时,它将显示特定请假请求的详细信息。在详细信息屏幕中,经理可以批准/拒绝请假。在批准/拒绝特定的请假请求后,经理必须导航回请假请求列表。现在批准/拒绝的请假请求不应出现在列表中。
谁能告诉我如何在批准/拒绝请假请求后刷新列表。
下面是我的适配器代码:
private class MyCustomAdapter extends ArrayAdapter<EmployeeLeaveHistory>
{
private ArrayList<EmployeeLeaveHistory> leavesList;
public MyCustomAdapter(Context context,
int leaveOverviewListItem,
ArrayList<EmployeeLeaveHistory> empLeaveOverview) {
// TODO Auto-generated constructor stub
super(context, leaveOverviewListItem, empLeaveOverview);
this.leavesList = new ArrayList<EmployeeLeaveHistory>();
this.leavesList.addAll(empLeaveOverview);
}
public class ViewHolder{
TextView status = null;
//TextView reason = null;
TextView startDate = null;
TextView duration = null;
}
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
ViewHolder holder;
LayoutInflater li = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = li.inflate(R.layout.leave_overview_list_item, null);
holder = new ViewHolder();
holder.startDate = (TextView) convertView.findViewById(R.id.txtLeaveRequestStartDate);
holder.duration = (TextView) convertView.findViewById(R.id.txtLeaveRequestDuration);
holder.status = (TextView) convertView.findViewById(R.id.txtLeaveRequestStatus);
final EmployeeLeaveHistory elh = leavesList.get(position);
convertView.setTag(elh);
if(elh != null)
{
elh.setListPosition(position);
holder.startDate.setText(elh.getLeaveStartDate());
holder.duration.setText(elh.getLeaveDuration());
holder.status.setText(elh.getLeaveStatus());
}
return convertView;
}
}