I am working on a app where in i have a basic activity,When i swipe from left to right i need i need to get a swipe window which will display few icons,when i click from right to left i need to get an swipe window from right to left...i researched a bit...nd found few options like navigation drawer and swipe window and view pager....but swipe gesture jst swipes continuously from one page to another...i dont want that...i need to display few icons when i swipe from left to right and right to left....but i don't know exactly which one to use for better navigation.... i used the following code:
@Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { String swipe = ""; float sensitvity = 50;
// TODO Auto-generated method stub
if((e1.getX() - e2.getX()) > sensitvity){
swipe += "Swipe Left\n";
SwipeLeft();
}else if((e2.getX() - e1.getX()) > sensitvity){
swipe += "Swipe Right\n";
}else{
swipe += "\n";
}
if((e1.getY() - e2.getY()) > sensitvity){
swipe += "Swipe Up\n";
}else if((e2.getY() - e1.getY()) > sensitvity){
swipe += "Swipe Down\n";
}else{
swipe += "\n";
}
gestureEvent.setText(swipe);
return super.onFling(e1, e2, velocityX, velocityY);
}
};
I am confused on wthr i should use swipe of view pager.. this is something what i want.. Help appreciated. Thanks.