Android : OnTouchListener not working properly in Fragment

on Thursday, September 11, 2014


I am building an app with fragment. I have on ImageView java file in that I am displaying only image.


When we click on image it will close that particular fragment and open the previous fragment. Working fine...!!! (For image I have used onClickListener)


But when I click on that view it goes two fragments back. (For view I have used onTouchListener)


The code is:



View v1 = inflater.inflate(R.layout.attachment_image, null);
v1.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
getFragmentManager().popBackStack();
return true;
}
});

0 comments:

Post a Comment