onFling gesture in WebView

by me tun » Tue, 12 May 2009 08:57:25 GMT


Sponsored Links
 Hello all,

Is there a way to detect the onFling gesture in a WebView?  It doesn't
seem to get recognised, for example:

I'll add all the code because it's a pretty good example of how to
listen to gesture...

        gestureDetector = new GestureDetector(new mGestureDetector());
        gestureListener = new View.OnTouchListener() {
            public boolean onTouch(View v, MotionEvent event) {
                if (gestureDetector.onTouchEvent(event)) {
                    return true;
                }
                return false;
            }
        };


...

    class mGestureDetector extends SimpleOnGestureListener {
        @Override
        public boolean onFling(MotionEvent e1, MotionEvent e2, float
velocityX, float velocityY) {
            try {
                if (Math.abs(e1.getY() - e2.getY()) >
SWIPE_MAX_OFF_PATH)
                    return false;
                // Right to left fling
                if(e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {

                        Log.d(TAG, "Right to left fling");

                }  else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE
&& Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {

                        Log.d(TAG, "Left to right fling");

                }
            } catch (Exception e) {
                // Nothing
            }
            return false;
        }
    }

...

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (gestureDetector.onTouchEvent(event))
                return true;
            else
                return false;
    }

This works for a FrameLayout, TextView, etc  I just can't seem to get
it to work in a WebView, is there some flag I need to enable to allow
the gestures to get through?
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Spotify on Android

Does anyone else have a problem when using spotify, where it always 
forgets username/password

--

2. Solved: Authenticating android to App Engine

I've been working for the past couple of days to allow users to login
to an android app with their gmail account and pass the authentication
token to my app hosted on app engine - so i can download xml from my
web services hosted on app engine as if the user logged into the app
directly.

There is a lot of info on ways to get the google auth code and the
auth cookie and then pass the cookie in the header of an http request
- but no  info out there on doing all of this from android and going
as far as to add the cookie to the remaining http requests. So, now
that's it's working, i thought i'd compile it all together and post
the solution here in my blog - enjoy.


http://javagwt.blogspot.com/2009/12/authenticating-android-app-to-google.html

-- 

3. Matiin kamera punya suara

4. Avoiding String allocation in TextView.setText()

5. who created these "Binder Thread" ?

6. Cannot view saved image until reboot

7. How to perform Web Search without requiring UI