Trigger ACTION_MOVE in Fragment while finger is already pressed down
<p><strong>Setup</strong></p>

<p>In Fragment A I have a Button with an onTouchListener. If I touch the Button, Fragment A is replaced by Fragment B.</p>

<p>Fragment B has an onTouchListener on its root view, and I want to capture the ACTION_MOVE right away.</p>

<p><strong>What I want to achieve</strong>
I want to be able to touch the button, see Fragment B appear and immediately act upon the touches.</p>

<p><strong>The problem</strong></p>

<p>No onTouches are called before I lift my finger and touch again.</p>

<p><strong>What I tried</strong></p>

<pre><code>private void dispatchTouch(FrameLayout layout_for_dragging) {
        // Obtain MotionEvent object
        long downTime = SystemClock.uptimeMillis();
        long eventTime = SystemClock.uptimeMillis() + 100;
        float x = 0.0f;
        float y = 0.0f;
        // List of meta states found here:     developer.android.com/reference/android/view/KeyEvent.html#getMetaState()
        int metaState = 0;
        MotionEvent motionEvent = MotionEvent.obtain(
                downTime,
                eventTime,
                MotionEvent.ACTION_DOWN,
                x,
                y,
                metaState
        );

        // Dispatch touch event to view
        layout_for_dragging.dispatchTouchEvent(motionEvent);
    }
</code></pre>

<p>and call this in onCreateView after I set the onTouchListener to the root view.</p>

<p>I wanted to force an event in the hopes that it would pick up my move events, but it only calls ACTION_DOWN once.</p>