title: Android Swipe for listview
body: <p>I did the coding as below:</p>
  
  <pre><code>public class MenuFragment extends ListFragment {
      private SlideoutHelper mSlideoutHelper;
      public final GestureDetector gdt = new GestureDetector(
              new GestureListener());
      @Override
      public void onActivityCreated(Bundle savedInstanceState) {
          super.onActivityCreated(savedInstanceState);
  
          setListAdapter(new ArrayAdapter&lt;String&gt;(getActivity(),
                  android.R.layout.simple_list_item_1, new String[] { " First",
                          " Second", " Third", " Fourth", " Fifth", " Sixth",
                          " Seventh", " Eighth", " Ninth", " Tenth" }));
           getListView().setCacheColorHint(0);
           getListView().setOnTouchListener(new OnTouchListener() {
                  public boolean onTouch(final View view, final MotionEvent event) {
  
                      return gdt.onTouchEvent(event);
                  }
              });
      }
  
      @Override
      public void onListItemClick(ListView l, View v, int position, long id) {
          super.onListItemClick(l, v, position, id);
          // ((MenuActivity)getActivity()).getSlideoutHelper().close();
  
          Context con = v.getContext();
  
          if (position == 0) {
              Toast.makeText(con, "First Clicked", 5).show();
          } else {
              Toast.makeText(con, "Clicked", 5).show();
          }
      }
      public class GestureListener extends SimpleOnGestureListener {
  
          private final int SWIPE_MIN_DISTANCE = 120;
          private final int SWIPE_THRESHOLD_VELOCITY = 2000;
  
          @Override
          public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
                  float velocityY) {
  
              if (e2.getX() - e1.getX() &gt; SWIPE_MIN_DISTANCE
                      &amp;&amp; Math.abs(velocityX) &gt; SWIPE_THRESHOLD_VELOCITY) {
                  System.out.println("flingggggggggg");
                   mSlideoutHelper.close();
  
  
                  return true;
              }
  
              return false;
          }
      }
  }
  </code></pre>
  
  <p>But it does not work. Please help me. How can I get the swipe option in this view?</p>