Remove from Recycler View with outside
<p>I am new in Android. My Application is utilizing Recycler View and the firebase sends the triggering update to add, edit delete the checkbox in Recycler view.</p>

<p>The interactor gets the triggered update from the server which then calls the addItem,UpdateItem or RemoveItem method in adapter through presenter. </p>

<p>I can add, update fine in Recycler View but when I am trying to remove the item from the Recycler view I am having difficult time in getting position of adapter.</p>

<p>Through Iterating, I can figure out the index of ArrayList but I don't know how to get position of the view to remove it. </p>

<p>The below code in removeItem method removes the required view perfectly fine but also duplicate(add) the last view again.
What I need is to remove the whole view without adding the duplicate last view.  I don't know how to get <code>getadapterPosition()</code>, Since I am not dealing with local triggers like onClick.</p>

<pre><code>public class CustomShoppingRecyclerAdapter extends RecyclerView.Adapter&lt;CustomShoppingRecyclerAdapter.ViewHolder&gt; implements ShoppingAdapterView {
private final ArrayList&lt;Shopping&gt; mMessageList = new ArrayList&lt;&gt;();

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.user_item, parent, false);
    vh= new ViewHolder(v);

    return new ViewHolder(v);
}

@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
    final Shopping current = mMessageList.get(position);

    holder.mShoppingItemCheckBox.setTag(current.getItem());
    holder.mShoppingItemCheckBox.setText(current.getItem());
    holder.mShoppingItemCheckBox.setChecked(current.getItemStatus());
    holder.mShoppingItemCheckBox.setOnClickListener(null);

    holder.mShoppingItemCheckBox.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                    current.setItemStatus(holder.mShoppingItemCheckBox.isChecked());
                    presenter.updateItemToServer(current);
              tag=  (String) holder.mShoppingItemCheckBox.getTag();
            }
        });
}

@Override
public void removeItem(Shopping shopping) {
    Integer index = 0;

    for (Shopping _item : mMessageList) {
        index = mMessageList.indexOf(_item);

        if (_item.getItem().equals(shopping.getItem())) {
                if (index != -1) {
                    mMessageList.remove(index);
                    notifyItemRemoved(index);
                }
        }
    }
}

class ViewHolder extends RecyclerView.ViewHolder {
    private CheckBox mShoppingItemCheckBox;
    private TextView mMessageTextView;

     ViewHolder(View itemView) {
        super(itemView);

itemView.findViewById(R.id.shopping_author);
        mShoppingItemCheckBox = (CheckBox) itemView.findViewById(R.id.shopping_item);
    }
</code></pre>