views:

66

answers:

2

hello guys,

i have a image view which is drag able and zoom able but now i also need to put setOnLongClickListner on my image view. i have done that but it is not working. but when i disabled the ontouch event it started working. can anybody tell me please how to fix that. here is my code

    image.layout(0, 30, screenWidth, screenHeight - 30);
    image.setScaleType(ImageView.ScaleType.FIT_XY);


    params = new RelativeLayout.LayoutParams(screenWidth, screenHeight - 30);
    params.leftMargin = 0;
    params.topMargin = 30;


    layout.addView(image, params);

    image.setOnLongClickListener(new View.OnLongClickListener() {
        public boolean onLongClick(View v) {


            Log.i("its working", "its working");

            return true;
                    }
    });

    image.setOnTouchListener(this);

i,ll be very thankful.

thanks a lot.

A: 

I think that the Object can have either an onClick or an onTouch, and it will use whatever the last one defined is. I have noticed this recently in some of my apps too.

TehGoose
A: 

According to the developer docs

returning true from these event listeners will stop the propagation of the event to other event listeners and will also block the callback to the default event handler in the View.So be certain that you want to terminate the event when you return true

So perhaps returning false in your methods that handle the events would bring you a step closer to what you want to achieve

x1886x