title: How to swipe to delete on RecyclerView?
body: <p>What I have here a History page that displays the requests the user have accepted or posted.  I was able to successfully put a button for the user to delete all of the history the user has.  Now I want the user to be able to delete a history one at a time by swiping it.</p>
  
  <p>HistoryFragment.java</p>
  
  <pre><code>RecyclerView rView;
  Button clear;
  DatabaseReference dRef;
  LinearLayoutManager llm;
  String id;
  
  View myView;
  
  @Nullable
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      myView = inflater.inflate(R.layout.history, container, false);
  
      FirebaseUser fu = FirebaseAuth.getInstance().getCurrentUser();
      id = fu.getUid();
      dRef = FirebaseDatabase.getInstance().getReference().child("History"+id);
      clear = (Button) myView.findViewById(R.id.clear);
      rView = (RecyclerView) myView.findViewById(R.id.history_list);
      rView.setHasFixedSize(true);
      llm = new LinearLayoutManager(getActivity());
      llm.setReverseLayout(true);
      llm.setStackFromEnd(true);
      rView.setLayoutManager(llm);
  
      clear.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              dRef.removeValue();
          }
      });
  
      return myView;
  }
  @Override
  public void onStart() {
      super.onStart();
      FirebaseRecyclerAdapter&lt;HistoryData, HistoryFragment.RequestViewHolder&gt; fra = new FirebaseRecyclerAdapter&lt;HistoryData, HistoryFragment.RequestViewHolder&gt;(
              HistoryData.class,
              R.layout.historylistview,
              HistoryFragment.RequestViewHolder.class,
              dRef
      ) {
          @Override
          protected void populateViewHolder(final HistoryFragment.RequestViewHolder viewHolder, HistoryData model, final int position) {
  
              viewHolder.setTrans(model.getTrans());
              viewHolder.setRequestDeadline(model.getRequestDeadline());
              viewHolder.setRequestDescription(model.getRequestDescription());
              viewHolder.setDateTimeAccepted(model.getDateTimeAccepted());
              viewHolder.setRequestLocation(model.getRequestLocation());
              viewHolder.setProfile(getApplicationContext() ,model.getProfile());
  
          }
  
      };
      rView.setAdapter(fra);
  }
  public static class RequestViewHolder extends RecyclerView.ViewHolder{
      View myView;
  
      public RequestViewHolder(View itemView) {
          super(itemView);
  
          myView = itemView;
      }
      public void setTrans(String profile){
          TextView trans = (TextView) myView.findViewById(R.id.transaction);
          trans.setText(profile);
      }
      public void setRequestDeadline(String dead){
          TextView rdead = (TextView) myView.findViewById(R.id.rDead);
          rdead.setText(dead);
      }
      public void setRequestDescription(String desc){
          TextView rdesc = (TextView) myView.findViewById(R.id.rDesc);
          rdesc.setText(desc);
      }
      public void setDateTimeAccepted(String date){
          TextView dta = (TextView) myView.findViewById(R.id.rAccept);
          dta.setText(date);
      }
      public void setRequestLocation(String loc){
          TextView rloc = (TextView) myView.findViewById(R.id.rLoc);
          rloc.setText(loc);
      }
      public void setProfile(Context c, String profile){
          ImageView rprofile = (ImageView) myView.findViewById(R.id.HPicture);
          Picasso.with(c).load(profile).into(rprofile);
      }
  }
  
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
      super.onCreateOptionsMenu(menu, inflater);
  }
  </code></pre>
  
  <p>I haven't really tried anything because the other questions I've seen here so far doesn't seem to be similar to my codes.</p>