In my project have used onTouchEvent for detecting touch on the screen and doing action accordingly , and have used viewPager for swipe action. Problem is on swipe the touch actions are getting executed. so find the solution from here solved it. But my new Problem to it is the touch is getting disabled after once TouchEvent.Action_up gets executed. code is as follows:
parent.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
switch(event.getAction())
{
case MotionEvent.ACTION_MOVE:
awesomePager.requestDisallowInterceptTouchEvent(true);
break;
case MotionEvent.ACTION_UP:
awesomePager.requestDisallowInterceptTouchEvent(true);
if(flag)
{
upperdock.setClickable(false);
upperdock.bringToFront();
tocparent.bringToFront();
tocbottom.bringToFront();
upperdock.setVisibility(RelativeLayout.VISIBLE);
tocparent.setVisibility(LinearLayout.VISIBLE);
tocbottom.setVisibility(LinearLayout.VISIBLE);
flag=false;
}
else
{
parent.bringToFront();
upperdock.setVisibility(RelativeLayout.INVISIBLE);
tocparent.setVisibility(LinearLayout.INVISIBLE);
tocbottom.setVisibility(LinearLayout.INVISIBLE);
flag=true;
}
break;
case MotionEvent.ACTION_CANCEL:
awesomePager.requestDisallowInterceptTouchEvent(false);
break;
default:
break;
}
return false;
}
});
In the above code if i return false Action_up is not getting executed.. if i return true Action_cancel is not getting executed..that is pass by value is the problem in there.