title: Android update recyclerView items
body: <p>i have simple problem on update <code>recyclerview</code> items by new data, i'm wondering which code work fine without using data binding, in my code adding new items trigger by click on button as <code>clickOnSendCommandToRobot</code> method, this method must add new item into <code>List</code> and my adapter can be know that to add new data and refresh <code>RecyclerView</code>, i dont get any error, but list size is <code>1</code> always </p>
  
  <pre><code>public class ActivityRegister extends BaseActivities {
      private RobotMessagesAdapter adapter;
      private List&lt;RobotViewModel&gt; model;
      private static final String TAG = "register";
  
      @Override
      public void onCreate(@Nullable Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          binding = DataBindingUtil.setContentView(this, R.layout.activity_register);
  
          ActivityRegisterPresenter presenter = new ActivityRegisterPresenter(this);
          ActivityRegisterViewModel viewModel = new ActivityRegisterViewModel();
          binding.setViewModel(viewModel);
          binding.setPresenter(presenter);
  
          if (savedInstanceState == null) {
              model = new ArrayList&lt;&gt;();
          } else {
              model = savedInstanceState.getParcelableArrayList("model");
          }
          adapter = new RobotMessagesAdapter(this, model);
          binding.registerRobot.setAdapter(adapter);
  
          ...
      }
      @Override
      public void clickOnSendCommandToRobot() {
          RobotViewModel temp = new RobotViewModel();
          temp.setMessage(Math.round(Math.random()) + "");
          temp.setMessageType(SV.RobotMessageType.SENT_BY_ROBOT.ordinal());
          model.add(temp);
  
          Log.e(TAG, model.size() + "");
  
          adapter.setData(model);
      }
  
      @Override
      protected void onSaveInstanceState(Bundle outState) {
          outState.putParcelableArrayList("model", (ArrayList) model);
          super.onSaveInstanceState(outState);
      }
  }
  </code></pre>
  
  <p>adapter <code>setData</code> method:</p>
  
  <pre><code>public void setData(List&lt;RobotViewModel&gt; data) {
      Log.e("data size ", data.size() + "");
      list.clear();
      list.addAll(data);
      notifyDataSetChanged();
  }
  </code></pre>
  
  <p>for each clicking on button and trigger <code>clickOnSendCommandToRobot</code> method. <code>model</code> variable clear and i don't have latest added items into that and adapter dont refresh list by new added item. 
  Logcat:</p>
  
  <pre><code>04-08 08:29:45.342 21470-21470/com.sample.myapp E/register: 1
  04-08 08:29:45.343 21470-21470/com.sample.myapp E/data size: 1
  04-08 08:29:46.658 21470-21470/com.sample.myapp E/register: 1
  04-08 08:29:46.658 21470-21470/com.sample.myapp E/data size: 1
  04-08 08:29:47.462 21470-21470/com.sample.myapp E/register: 1
  04-08 08:29:47.462 21470-21470/com.sample.myapp E/data size: 1
  </code></pre>