public void addReceivedMessage(Message message){
  data.add(message);
  notifyItemInserted(data.size() - 1);
  notifyItemChanged(Math.max(0,data.size() - 2));
}

public void addReceivedMessage ( Message message ) { data . add ( message ) ; notifyItemInserted ( data . size ( ) - 1 ) ; notifyItemChanged ( Math . max ( 0 , data . size ( ) - 2 ) ) ; }
add received message to adapter
