0
어댑터 내부에서 addItem() 메서드가 호출되었습니다. MainAcivity에서 호출하려고합니다.어댑터 내부에서 메서드 호출 클래스
public class MessageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final int VIEW_TYPE_FIRST = 0;
private static final int VIEW_TYPE_SECOND = 1;
List<Message> mList;
Context context;
LayoutInflater inflater;
public MessageAdapter(Context context, List<Message> mList) {
this.context = context;
this.mList = mList;
this.inflater = LayoutInflater.from(context);
}
public void addItem(Message item) {
mList.add(mList.size()+1,item);
notifyItemInserted(mList.size()+1);
}