NagarjunaReddy
NagarjunaReddy

Reputation: 8645

Android Imageview setOnTouchListener not working?

i'am using imageview on touch listener in this motion event not working why this happen any one have idea regarding this help me.

here is my code

   img_View11.setOnTouchListener(new View.OnTouchListener() {               
        public boolean onTouch(View v, MotionEvent event) {             
            Log.i("img_View11", "img_View11 _1");

            int action = event.getAction();
            switch (action) {

            case MotionEvent.ACTION_DOWN:
                Log.i("img_View11", "img_View11 _2");                                            
                break;

            case MotionEvent.ACTION_MOVE:
                Log.i("img_View11", "img_View11 _3");    
                break;

            case MotionEvent.ACTION_UP:
                Log.i("img_View11", "img_View11 _4");
                break;               
            }               
            return false;
        }
    });

here my out put show like this img_View11_1 and two img_View11_2

 Log.i("img_View11", "img_View11 _1");
 Log.i("img_View11", "img_View11 _2");

Question: Why MotionEvent.ACTION_MOVE and MotionEvent.ACTION_UP not working ?

Upvotes: 3

Views: 7199

Answers (1)

Bobby
Bobby

Reputation: 6255

Change "return false;" to "return true;" so that it will continue to receive calls.

Upvotes: 3

Related Questions