Android onScroll problems

view story

http://stackoverflow.com – @Override public boolean onScroll(MotionEvent arg0, MotionEvent arg1, float arg2, float arg3) { // TODO Auto-generated method stub if(arg0.getX()<arg1.getX()&&id!=0x7f020000) { previousId=id-1; imageView.setImageResource(id); id++; } else if(arg0.getX()>arg1.getX()&& id!=0x7f020004) { imageView.setImageResource(previousId); } return true; } The problem is when I scrolled, the id plus 2 instead 1. I don't understand why. Does someone can explain why? and how to solve it? (HowTos)