I\'m using my own GestureDetector class to detect a left|right onFling event. Everything I see looks good in my code but nothing happens...?
I need the added function
I think one reason is that Gesture work on onFling
that condition not satisfied in u r code
i have implemented one OntouchListener try this
yourView.setOnTouchListner(onThumbTouch );
OnTouchListener onThumbTouch = new OnTouchListener()
{
float previouspoint = 0 ;
float startPoint=0;
@Override
public boolean onTouch(View v, MotionEvent event)
{
switch(v.getId())
{
case R.id.tvDetailsalaujairiyat: // Give your R.id.sample ...
{
switch(event.getAction())
{
case MotionEvent.ACTION_DOWN:
{
startPoint=event.getX();
System.out.println("Action down,..."+event.getX());
}
break;
case MotionEvent.ACTION_MOVE:
{
}break;
case MotionEvent.ACTION_CANCEL:
{
previouspoint=event.getX();
if(previouspoint > startPoint){
//Right side swape
}else{
// Left side swape
}
}break;
}
break;
}
}
return true;
}
};
I give credit to @Devunwired as he suggested above:
If layout contains children that are also touchable, they may be stealing the events from their parent (your layout).
So I added:
View swipeView = (View) findViewById(R.id.animation_layout_content);
swipeView .setOnTouchListener(new View.OnTouchListener() {...});
Which works wonderfully now.