How to reset OnTouchListener?
<p>I have a custom object which also extends <code>View.OnTouchListener</code>. It uses <code>onTouch</code> events to be dragged around. Whenever this custom object detects a collision with a target object, it fires up custom event. Upon receiving this event, <code>MainActivity</code> uses public method of that custom object to start animation, which moves custom object to initial position. In the <code>onAnimationStart</code> of <code>AnimatorSet</code>, <code>OnTouchListener</code> is set to <code>null</code> and in the <code>onAnimationEnd</code> that custom object is again assigned with <code>OnTouchListener</code> - this is the culprit of malfunction, which is as follows.
I touch custom view and drag my finger to target object, but I dont release my finger when animation of return to initial position starts and keep dragging it around target object. The custom view returns to initial position, but then re-appears at touched position and returns to initial position and this repeats again and again.</p>

<p>I tried breaking the MOVE event, returning "true" to consume the event, but nothing helps. How do I release/reset new <code>onTouchListener</code> from previous touch? </p>

<p>onTouch code (in MyCustomObject class):</p>

<pre><code>@Override
public boolean onTouch(final View view, MotionEvent motionEvent) {
        switch (motionEvent.getAction()) {

            case MotionEvent.ACTION_DOWN: {

                //moves view's center to the click location

                break;
            }

            case MotionEvent.ACTION_UP: {

                //returns view to initial position

                break;
            }

            case MotionEvent.ACTION_MOVE: {

                //moves the view at the center of touch -- dragging function

                //checks for collision 
                if (collission occured) {

                        //trigger event
                        listener.myEvent((MyCustomObject) view);

                }

                break;
            }

        }

        //does not consume touch
        return true;

    }
</code></pre>

<p>Event handling code (in MainActivity class):</p>

<pre><code>    MyCustomObject.EventsListener listener = new MyCustomObject.EventsListener() {
            @Override
            public void MyEvent(MyCustomObject submittedObject) {

                 //some code to decide if return to initial position should occur

                 //return custom object to initial position
                 submittedObject.returnToInitPosition(submittedObject);

                }

            }
</code></pre>

<p>Code of returnToInitPosition() (in MyCustomObject class):</p>

<pre><code>public void returnToInitPosition(final View view) {

    //return to initial position animation
    AnimatorSet set = new AnimatorSet();
    set.playTogether(---my anims---);

    //temporary remove of onTouch listener
    set.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            super.onAnimationStart(animation);

            //remove listener on animation start
            view.setOnTouchListener(null);
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);

            //re-add listener on animation complete
            view.setOnTouchListener(MyCustomObject.this);
        }

    });

    //start animation
    set.start();

}
</code></pre>