I am making a simple chat app, when I write a message and show it on the screen the app stops, I suspect that the error is in notifyItemInserted () and I would like to know if I am misusing the function or if it exists another way to make messages appear on the screen.
Thanks for your help!
public class AdapterMensajes extends RecyclerView.Adapter<HolderMensaje> {
private List<Mensaje> listMensaje = new ArrayList<>();
private Context c;
public AdapterMensajes(Context c) {
this.c = c;
}
public void addMensaje(Mensaje m){
listMensaje.add(m);
notifyItemInserted(listMensaje.size());
}
This is the error shown in the LogCat:
09-06 15: 27: 39.896 6174-6174 / vdachi.startalking E / AndroidRuntime: FATAL EXCEPTION: main Process: vdachi.startalking, PID: 6174 android.view.InflateException: Binary XML file line # 16: Binary XML file line # 16: Error inflating class android.support.v4.widget.CircleImageView Caused by: android.view.InflateException: Binary XML file line # 16: Error inflating class android.support.v4.widget.CircleImageView Caused by: java.lang.NoSuchMethodException: [class android.content.Context, interface android.util.AttributeSet]