swipe and scrolling working together
<p>I am making a app in which I have a textview(occupying most of my activity). Textview displays a large amount of text across multiple pages (pages are nothing but the large text assigned into a string array and each array element being displayed on page change trigger). I used the code from below thread to introduce right/left swipe to navigate across pages.</p>

<p><a href="http://stackoverflow.com/questions/4139288/android-how-to-handle-right-to-left-swipe-gestures">Android: How to handle right to left swipe gestures</a></p>

<p>Below is the exact code I am using in my all.</p>

<pre><code>public class OnSwipeTouchListener extends Activity implements OnTouchListener{

private final GestureDetector gestureDetector = new GestureDetector(getBaseContext(), new GestureListener());

public boolean onTouch(final View v, final MotionEvent event) {
    //super.onTouch(v, event);
    return gestureDetector.onTouchEvent(event);
}

private final class GestureListener extends SimpleOnGestureListener {

    private static final int SWIPE_THRESHOLD = 100;
    private static final int SWIPE_VELOCITY_THRESHOLD = 100;

    @Override
    public boolean onDown(MotionEvent e) {
        return true;
    }

    @Override
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
        boolean result = false;
        try {
            float diffY = e2.getY() - e1.getY();
            float diffX = e2.getX() - e1.getX();
            if (Math.abs(diffX) &gt; Math.abs(diffY)) {
                if (Math.abs(diffX) &gt; SWIPE_THRESHOLD &amp;&amp; Math.abs(velocityX) &gt; SWIPE_VELOCITY_THRESHOLD) {
                    if (diffX &gt; 0) {
                        onSwipeRight();
                    } else {
                        onSwipeLeft();
                    }
                }
            } 
        } catch (Exception exception) {
            exception.printStackTrace();
        }
        return result;
    }
}

public void onSwipeRight() {
}

public void onSwipeLeft() {
}
</code></pre>

<p>and then this is how I use this class in my activity</p>

<pre><code>        myTextView.setOnTouchListener(new OnSwipeTouchListener() {
        public void onSwipeRight() {
            displayPreviousPage() //code to display previous page
        }
        public void onSwipeLeft() {
            displayNextPage()  //code to display next page
        }
    });
</code></pre>

<p>Everything works fine till now. Now I wanted to enable vertical scrolling for my textview in case my text goes beyond the screen height. Hence I added the below line in my code to do the same.</p>

<pre><code>myTextView.setMovementMethod(new ScrollingMovementMethod());
</code></pre>

<p>But that doesn’t seem to work. Any suggestions why? Is it that I have overridden onFling method in my OnSwipeTouchListener class and that setMovementMethod was also using the same(onFling method) for its implementation? </p>
