title: How to delete items from Recycler View from another class?
body: <p>I have a Recycler View inside Bottom Sheet , and if the item is clicked, it will be shown in Fragment.</p>
  
  <p>Inside my Fragment i have a delete button (to delete item). How to call <code>list.remove(position);</code>?</p>
  
  <p>Delete Button method :</p>
  
  <pre><code>buttonDelete.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  if (view == buttonDelete){
                      switchCardAdapter.deleteMethod(1);
                  }
              }
          });
  </code></pre>
  
  <blockquote>
    <p>1 only dummy position , how do i get a real position from adapter?</p>
  </blockquote>
  
  <p>Delete Method inside Adapter : </p>
  
  <pre><code>public void deleteMethod(int position) {
          cards.remove(position);
      }
  </code></pre>
  
  <p>Full BindViewHolder method :</p>
  
  <pre><code>@Override
  public void onBindViewHolder(@NonNull final ViewHolder holder, int 
  position) {
         final Card card = cards.get(position); 
         holder.textNumber.setText(String.valueOf(card.getNumberCard()));
         holder.textName.setText(card.getName());
         holder.itemView.setOnClickListener(new View.OnClickListener()
          {
              @Override
              public void onClick(View view) {
                  Bundle b = new Bundle();
                  b.putString("name", card.getName());
                  b.putString("description", card.getDescripton());
                  b.putString("type", card.getType());
                  b.putLong("numberCard", card.getNumberCard());
                  b.putInt("cvv",card.getCvv());
                  b.putInt("exp", card.getExp());
                  b.putInt("pin", card.getPin());
                  cardFragment.setDataCard(b);
                  bottomSheetFragment.dismiss();
          }
      });
  }
  
  public void deleteMethod(int position) {
      cards.remove(position);
  }
  </code></pre>
  
  <p>Any help would be appreciated.</p>