title: RecyclerView notifyItemInserted duplicates previous entry's data
body: <p>So for some reason whenever I add a new item to my ArrayList and notify the recyclerview that it's been added, it duplicates the previous entry's data. So the view gets created but with data from the last entry not the current data.</p>
  
  <p>What's strange is that I save the items using ORM Sugar, and so when I retrieve them the correct data is displayed. Which shows that the data is getting added but the view is not showing it correctly.</p>
  
  <p>I can only assume recyclerview is not calling the onBindViewHolder whenever I use the method notifyItemInserted, <strong>because the correct data is shown when I use notifyDataSetChange()</strong></p>
  
  <p>Here's my method to add the new item</p>
  
  <pre><code>@Override
      public void AddCalorieToHistoryList(int calorieAmount, int currentCalorieAmount) {
          // Get the date and the calorie amount from what the user entered.
          Date date = new Date();
          // Create the calorie history item and then save it (via ORM Sugar Library)
          CalorieHistory calorieHistory = new CalorieHistory(date.toString(), calorieAmount);
          calorieHistory.save();
  
          // Notify the view of the new item that should be inserted.
          historyView.InsertNewListItem(calorieHistory);
  
          SubtractFromCurrentCalorieAmount(calorieAmount, currentCalorieAmount);
      }
  </code></pre>
  
  <p>historyView's method</p>
  
  <pre><code>@Override
      public void InsertNewListItem(CalorieHistory calorieHistoryItem) {
          // Add the new item
          calorieHistories.add(calorieHistoryItem);
          // Notify the insert so we get the animation from the default animator
          historyListAdapter.notifyItemInserted(0);
      }
  </code></pre>
  
  <p>Here's the recyclerview adapter</p>
  
  <pre><code>public class HistoryListAdapter extends RecyclerView.Adapter&lt;HistoryListAdapter.HistoryListViewHolder&gt; {
  
      List&lt;CalorieHistory&gt; calorieHistoryList;
  
  
      public HistoryListAdapter(List&lt;CalorieHistory&gt; historyList) {
          this.calorieHistoryList = historyList;
      }
  
      // I think this is run once, it generates the view holder from the layout that we are using for each list item.
      // This way it won't have to grab it each time we make a new list item. It's all stored on our view holder.
      @Override
      public HistoryListViewHolder onCreateViewHolder(ViewGroup parent, int i) {
          View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.calorie_history_item, parent, false);
  
          return new HistoryListViewHolder(itemView);
      }
  
      // This executes everytime we make a new list item, it binds the data to the view.
      @Override
      public void onBindViewHolder(HistoryListViewHolder holder, int position) {
          // Get the current calorHistory object and set it's data to the views.
          CalorieHistory calorieHistory = calorieHistoryList.get(position);
          holder.tvDate.setText(calorieHistory.date);
          holder.tvAmount.setText(String.valueOf(calorieHistory.numberOfCalories));
      }
  
      @Override
      public int getItemCount() {
          // Return the size of our array.
          return calorieHistoryList.size();
      }
  
      public static class HistoryListViewHolder extends RecyclerView.ViewHolder {
          public TextView tvDate;
          public TextView tvAmount;
  
          public HistoryListViewHolder(View v) {
              super(v);
              tvDate = (TextView) v.findViewById(R.id.calorie_date);
              tvAmount = (TextView) v.findViewById(R.id.calorie_amount);
          }
      }
  
  }
  </code></pre>