I'm using a GestureDetector
to have onFling()
called. It seems to be correctly detecting my flings as it triggers a Log message I created. I'm trying to determine the direction of the fling, but am running into problems. The x values are the same for both MotionEvent
objects passed into the onFling()
method so I cannot determine the direction. For example, I get:
08-05 16:36:08.679: DEBUG/mView(14616): fling2: 131.0 131.0
When I do:
Log.d("mView", "fling2: " + e1.getX() + " " + e2.getX());
When performing the fling, I am only moving my finger horizontal so this makes no sense to me. What could be going wrong here?
You can use droidQuery: https://github.com/phil-brown/droidQuery. It will really simplify your code and make it easy to use. Here is all you need to put in your activities onCreate():