tags:

views:

40

answers:

0

I'm playing around with an app I have written whose main activity is a TabActivity. I was considering allowing the user to navigate between tabs with a fling gesture, but I find that I can only detect flings on one of my four tabs.

public class WSGesture extends TabActivity implements OnGestureListener {

private GestureDetector gestureScanner;

@Override onCreate(Bundle savedInstanceState) {

gestureScanner = new GestureDetector(this);
...
}

.
.
.
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
Log.v(TAG, "onFling called, velX: " + velocityX + ", velY: " + velocityY);

return true;  

}

public boolean onTouchEvent(MotionEvent me) {
return gestureScanner.onTouchEvent(me);

}

When I execute this code, I only see onFling being called when one particular tab is set as the current tab. For the other three, I get nothing. It's always the third out of four, if that matters.