title: Fetching Data from RecyclerView and performing calculations on it
body: <p>I created a RecyclerView with cardview of linearlayout, and this RecyclerView fetches data from firebase real-time database. My RecyclerView looks as follows</p>
  <p><a href="https://i.stack.imgur.com/ZB7dV.png" rel="nofollow noreferrer">https://i.stack.imgur.com/ZB7dV.png</a></p>
  <p>Now, in the price section of the activity, I want to add the total price of all the views. But, I am not able to do that.</p>
  <p>I tried adding the item-price in <code>populateviewholder</code> method using the sum variable, but every time I scroll by RecyclerView the value sum changes, even if I have not added any extra item.</p>
  <p><a href="https://i.stack.imgur.com/b3PSJ.png" rel="nofollow noreferrer">https://i.stack.imgur.com/b3PSJ.png</a></p>
  <p>Please suggest a way, to calculate the total of all the prices of views in RecyclerView and then display it in the total section.</p>
  <h2>The red bar with text total is not the part of RecyclerView.</h2>