title: My recyclerview does not show my arraylist
body: <p>I have a recyclerview, edit text and button. And when I write something and click button my recyclerview have to show what I have inserted. But when I insert and click on button nothing happens but when I click on the button with empty edit text it shows me empty text view.</p>
  
  <p><strong>Here is my oncreate method:</strong></p>
  
  <pre><code>@Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_chat);
          mRecyclerViewChat = (RecyclerView) findViewById(R.id.messages_list_of_users);
          mInputMessageText = (EditText) findViewById(R.id.input_message);
          mSendMessageButton = (ImageButton) findViewById(R.id.send_message);
  
          LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
          mRecyclerViewChat.setLayoutManager(linearLayoutManager);
  
          chatAdapter = new ChatAdapter(mChatList);
          mRecyclerViewChat.setAdapter(chatAdapter);
      }
  </code></pre>
  
  <p><strong>Here is my onclick method:</strong></p>
  
  <pre><code>mSendMessageButton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  String message = mInputMessageText.getText().toString().trim();
                  if (message != null &amp;&amp; TextUtils.isEmpty(message)){
                      mChatList.add(message);
                      mInputMessageText.setText("");
                      Toast.makeText(ChatActivity.this, "message is not null", Toast.LENGTH_SHORT).show();
                      if (chatAdapter != null){
                          chatAdapter.notifyDataSetChanged();
                          Toast.makeText(ChatActivity.this, "chat adapter is not null", Toast.LENGTH_SHORT).show();
                      }
                  }
              }
          });
  </code></pre>
  
  <p><strong>And here is my adapter class:</strong></p>
  
  <pre><code>public class ChatAdapter extends  RecyclerView.Adapter&lt;ChatAdapter.ChatViewHolder&gt;{
      private ArrayList&lt;String&gt; mChatList;
      public ChatAdapter(ArrayList&lt;String&gt; mChatList) {
          this.mChatList = mChatList;
      }
      @Override
      public ChatViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
          View view = layoutInflater.inflate(R.layout.item_chat_box, parent, false);
          return new ChatViewHolder(view);
      }
      @Override
      public void onBindViewHolder(ChatViewHolder holder, int position) {
          holder.messageLeft.setText(mChatList.get(position));
      }
      @Override
      public int getItemCount() {
          return mChatList.size();
      }
      public class ChatViewHolder extends RecyclerView.ViewHolder {
          TextView messageLeft, messageRight;
          public ChatViewHolder(View itemView) {
              super(itemView);
              messageLeft = (TextView) itemView.findViewById(R.id.item_chat_box_left);
              messageRight = (TextView) itemView.findViewById(R.id.item_chat_box_right);
          }
      }
  } 
  </code></pre>
  
  <p><strong>And here is my layout file:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layout xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;RelativeLayout
          xmlns:app="http://schemas.android.com/apk/res-auto"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="@color/grey_bg"&gt;
  
          &lt;android.support.v7.widget.RecyclerView
              android:id="@+id/messages_list_of_users"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_marginTop="30dp"
              android:layout_marginBottom="80dp"
              android:layout_centerVertical="true"&gt;
  
          &lt;/android.support.v7.widget.RecyclerView&gt;
  
          &lt;LinearLayout
              android:id="@+id/message_linlay"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_alignParentBottom="true"
              android:layout_alignParentStart="true"
              android:orientation="horizontal"
              android:paddingLeft="5dp"
              android:paddingRight="5dp"
              android:paddingTop="5dp"
              android:paddingBottom="2dp"
              android:background="@color/white"&gt;
  
              &lt;ImageButton
                  android:id="@+id/select_image"
                  android:layout_width="50dp"
                  android:layout_height="50dp"
                  android:padding="5dp"
                  app:srcCompat="@drawable/ic_add_a_photo_black_24dp"
                  android:background="@color/white"/&gt;
  
              &lt;EditText
                  android:id="@+id/input_message"
                  android:layout_width="250dp"
                  android:layout_height="wrap_content"
                  android:ems="10"
                  android:hint="Write a message"
                  android:inputType="textMultiLine"
                  android:padding="10dp" /&gt;
  
              &lt;LinearLayout
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:gravity="right"&gt;
  
                  &lt;ImageButton
                      android:id="@+id/send_message"
                      android:layout_width="50dp"
                      android:layout_height="50dp"
                      android:paddingLeft="1dp"
                      app:srcCompat="@drawable/ic_send_black_24dp"
                      android:background="@color/white"/&gt;
              &lt;/LinearLayout&gt;
  
          &lt;/LinearLayout&gt;
  
      &lt;/RelativeLayout&gt;
  &lt;/layout&gt;
  </code></pre>
  
  <p>And if I enter nothing and click it shows me empty textview</p>