Q:

swipes are not getting detected

In the below posted code, I am trying to detect swipes using onDown and onFling but when I run the App, nothing appears. 
I expected to see output coming from onFling when I hold touching the screen and drag my finger across it quickly, but i received nothing. Also, I expected to see the output coming from onDown when I press on the screen, but as well, nothing showed up.
please let me know what I am missing Or I misundersatnd the functionalities of onFling on onDown?!
JavaCode:
super.onCreate(savedInstanceState);
    setContentView(R.layout.swipe_gesture_activivty);

    mGestureDetector = new GestureDetector(getApplicationContext(), new MySwipeGestureDetector());

            mViewGestureDetector = new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            return mGestureDetector.onTouchEvent(event);
        }
    };
    final TextView view = (TextView) findViewById(R.id.accXLabel);      
}

private class MySwipeGestureDetector extends SimpleOnGestureListener implements OnTouchListener {

    @Override
    public boolean onDown(MotionEvent e) {
        // TODO Auto-generated method stub
        Toast.makeText(getApplicationContext(), "onDown", Toast.LENGTH_LONG).show();
        return true;
    }

    @Override
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
            float velocityY) {
        // TODO Auto-generated method stub
        try {
            if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH)
                return false;
            // right to left swipe
            if(e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
                Toast.makeText(getApplicationContext(), "Left Swipe", Toast.LENGTH_SHORT).show();
            }  else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
                Toast.makeText(getApplicationContext(), "Right Swipe", Toast.LENGTH_SHORT).show();
            }
        } catch (Exception e) {
            // nothing
        }
        return false;

    @Override
    public boolean onTouch(View v, MotionEvent event) {
        // TODO Auto-generated method stub
        return mGestureDetector.onTouchEvent(event);
    }

}

}

A:

First, I assume for an example that, all your views in the layout.xml file are wrapped inside a framelayout and you want your swipes to be detectable across the entire framelayout. If so, register your framelayout to the object of the type GestureDetector as shown in the following code:
FrameLayout mFL = (FrameLayout) findViewById(R.id.framelayoutID);

    mGestureDetector = new GestureDetector(getApplicationContext(), new MySwipeGestureDetector());
    mFL.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            return mGestureDetector.onTouchEvent(event);
        }
    }); 

Regarding the simpleOnGestureListener, here is how to implement onFling. it works for me.:
//define these variables globally:
/* private static final int MIN_DIST = 100;
private static final int MAX_OFF_PATH = 200;
private static final int THRESHOLD_VELOC = 200;*/
...
...
...
@Override
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
            float velocityY) {
        // TODO Auto-generated method stub
        try {
            if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH)
                return false;
            // right to left swipe
            if(e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
                Log.i("SwipeGesture", "Left Swipe");
            }  else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
                Log.i("SwipeGesture", "Right Swipe");
            }
        } catch (Exception e) {
            // nothing
        }
        return false;
    }       
}

