How to get Last latest value from RecyclerView
<p>I am making Garage Application just like Calculator..Taking 2 values from <code>EditText</code> and print in third <code>EditText</code>.and then it will store all values in <code>RecyclerView</code>.<strong>Now issue is I am trying to get the latest Total Gross value ie last row Total Value</strong> I had done all possibly Solution still I am not getting.</p>

<p>Here is my code in Custom Adapter:</p>

<pre><code>@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
    Employee employee = bank_details.get(position);


    holder.total.setText(employee.getTotal());
    holder.accept.setText(employee.getAcceptmoney());
    holder.given.setText(employee.getGivemoney());
    holder.note.setText(employee.getNote());
    holder.date.setText(employee.getTime());

    int selectedItem = 0;
    if(selectedItem == position)
        holder.itemView.setSelected(true);


}

@Override
public int getItemCount() {
    return bank_details.size();
}

public void setSelectedItem(int last_pos) {
}


public class MyViewHolder extends RecyclerView.ViewHolder {
    CardView cv;
    TextView total;
    TextView accept;
    TextView given;
    TextView note;
    TextView date;

    Button edit;
    Button delete;

    public MyViewHolder(View itemView) {
        super(itemView);
        cv= (CardView) itemView.findViewById(R.id.cv);
        total = (TextView) itemView.findViewById(R.id.grossIncome);
        accept = (TextView) itemView.findViewById(R.id.acceptmoney);
        given = (TextView) itemView.findViewById(R.id.givenmoney);
        note = (TextView) itemView.findViewById(R.id.note);
        date= (TextView) itemView.findViewById(R.id.date);


    }
}
public Employee getItem(int position) {
    return bank_details.get(position);
}
</code></pre>

<p>Here is the code of recyclerview:</p>

<pre><code>@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recyclerview);

    final RecyclerView rv = (RecyclerView) findViewById(R.id.rv);
    rv.setHasFixedSize(true);

    final ArrayList&lt;Employee&gt; arr = InitializeData();

    final LinearLayoutManager llm = new LinearLayoutManager(this);
    rv.setLayoutManager(llm);
    rv.setHasFixedSize(true);

    cu = new CustomAdapter(arr);
    rv.setAdapter(cu);

    int last_pos = cu.getItemCount() - 1;
    cu.notifyDataSetChanged();
    cu.setSelectedItem(last_pos);
    rv.scrollToPosition(last_pos);
}

public ArrayList&lt;Employee&gt; InitializeData() {
    ArrayList&lt;Employee&gt; arr_emp = new ArrayList&lt;&gt;();
    ArrayList&lt;Employee&gt; arr_emp_2 = new ArrayList&lt;&gt;();



    DAL dal = new DAL(this);
    dal.OpenDB();
    arr_emp = dal.AllSelectQryForTabEmpData();
    dal.CloseDB();
    return arr_emp;



}
public void setSelectedItem(int position)
{
    selectedItem = position;
}
</code></pre>

<p>Problem is I want total value and that total value can be used as giving and receiving value ie-<strong>Total+receving Money</strong>,<strong>Total-giving Money</strong></p>