Este es mi adaptador, en el holder
estoy haciendo el parseo, pero cuando ejecutola aplicación, ésta se me detiene.
public class Adaptador extends
RecyclerView.Adapter<Adaptador.AdapaterViewHolder> {
private List<Agenda>lista;
private Context mainContext;
private SimpleDateFormat formatter;
public Adaptador(List<Agenda>lista ){
this.lista=lista;
this.formatter = new SimpleDateFormat("yyyy-MM-dd");
}
@Override
public AdapaterViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v= LayoutInflater.from(parent.getContext()).inflate(R.layout.cardview,parent,false);
return new AdapaterViewHolder(v);
}
@Override
public void onBindViewHolder(AdapaterViewHolder holder, int position) {
//datos que voy a mostrar
holder.tipo_solicitud.setText(lista.get(position).getTipo_solicitud());
holder.tipo_traslado.setText(lista.get(position).getTipo_traslado());
try {
Date date = formatter.parse(lista.get(position).getFecha_cita());
String fecha = date.toString();
holder.fecha_cita.setText(fecha);
} catch (ParseException e) {
e.printStackTrace();
}
holder. identificacion.setText(lista.get(position).getIdentificacion());
holder. nombre.setText(lista.get(position).getNombre());
holder.fecha_nacimiento.setText(lista.get(position).getFecha_nacimiento());
holder.entidad_eps.setText(lista.get(position).getEntidad_eps());
holder. lugar_recoger.setText(lista.get(position).getLugar_recoger());
holder. departamento_recoge.setText(lista.get(position).getDepartamento_recoge());
holder. ciudad_recoge.setText(lista.get(position).getCiudad_recoge());
holder.medico_recibe.setText(lista.get(position).getMedico_recibe());
holder.lugar_destino.setText(lista.get(position).getMedico_recibe());
holder.departamento_destino.setText(lista.get(position).getLugar_destino());
holder. diagnostico.setText(lista.get(position).getDiagnostico());
holder.soportes_vitales.setText(lista.get(position).getSoportes_vitales());
holder.observaciones.setText(lista.get(position).getObservaciones());
}
@Override
public int getItemCount() {
return lista.size();
}
public class AdapaterViewHolder extends RecyclerView.ViewHolder {
TextView tipo_solicitud;
TextView tipo_traslado;
TextView fecha_cita;
TextView identificacion;
TextView nombre;
TextView fecha_nacimiento;
TextView entidad_eps;
TextView lugar_recoger;
TextView departamento_recoge;
TextView ciudad_recoge;
TextView medico_recibe;
TextView lugar_destino;
TextView departamento_destino;
TextView diagnostico;
TextView soportes_vitales;
TextView observaciones;
public AdapaterViewHolder(View itemView) {
super(itemView);
tipo_solicitud = (TextView) itemView.findViewById(R.id.tvTipo_solictud);
tipo_traslado =(TextView) itemView.findViewById(R.id.tvTipo_traslado);
fecha_cita= (TextView) itemView.findViewById(R.id.tvFecha_solicitud);
identificacion = (TextView) itemView.findViewById(R.id.tvIdentificacion);
nombre= (TextView) itemView.findViewById(R.id.tvNombre_paciente);
fecha_nacimiento= (TextView) itemView.findViewById(R.id.tvFecha_Nacimiento);
entidad_eps= (TextView) itemView.findViewById(R.id.tvEndidad_eps);
lugar_recoger= (TextView) itemView.findViewById(R.id.tvLugar_recoger);
departamento_recoge= (TextView) itemView.findViewById(R.id.tvDepartamento);
ciudad_recoge= (TextView) itemView.findViewById(R.id.tvCiudad_recoge);
medico_recibe= (TextView) itemView.findViewById(R.id.tvMedico_Recibe);
lugar_destino= (TextView) itemView.findViewById(R.id.tvLugar_destino);
departamento_destino= (TextView) itemView.findViewById(R.id.tvDepartamento_destino);
diagnostico= (TextView) itemView.findViewById(R.id.tvDiagnostico);
soportes_vitales= (TextView) itemView.findViewById(R.id.tvSoportes_vitales);
observaciones= (TextView) itemView.findViewById(R.id.tvObservacion);