Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6206239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:24:59+00:00 2026-05-24T05:24:59+00:00

Update: I figured out what is happening. See comments. I am trying to write

  • 0

Update: I figured out what is happening. See comments.

I am trying to write a ViewSwitcher that passes all gestures to its first child until it receives a scale gesture; it then passes them to its second child until that child is zoomed out again completely, when it reverts to the first child. My subclass has a ScaleGestureDetector and I made a very simple listener:

    protected class OnScaleModeSwitcher implements ScaleGestureDetector.OnScaleGestureListener
    {
        protected PageFlipSwitcher owner;

        public OnScaleModeSwitcher(PageFlipSwitcher newOwner)
        {
            super();
            owner = newOwner;
        }

        @Override
        public boolean onScale(ScaleGestureDetector detector) {
            return false;
        }

        @Override
        public boolean onScaleBegin(ScaleGestureDetector detector) {
            owner.onScaleBegin();
//returning false here causes the rest of the gesture to be ignored.
            return false;
        }

        @Override
        public void onScaleEnd(ScaleGestureDetector detector) {
            owner.onScaleEnd();
        }
    }

As you can see all it does is take a reference to the owner object on construction, then pass some events to methods within the owner class. However, onScaleEnd() is not being reached by the code.

I’m aware that onInterceptTouchEvent can be a little dicey; I followed the suggestions in the Android docs for it as closely as possible and have

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev)
    {
        onTouchEvent(ev);
        return false;
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev)
    {
//mode is the name of the ScaleGestureDetector
        mode.onTouchEvent(ev);

//this code just passes events to the children
//it seems to work OK
        if(zoomActive)
        {
            //ZoomSwitcher
            getChildAt(1).onTouchEvent(ev);
        }
        else
        {
            //Gallery
            getChildAt(0).onTouchEvent(ev);
        }
        return true;
    }

I read somewhere else that a GestureDetector may not receive the ACTION_UP event:

Android: How to detect when a scroll has ended

Is that what is happening here? If so what is the point of the onScaleEnd() method?

EDIT:

I have worked this out: it is because my methods return false. Eclipse auto-implemented some stubs and I didn’t change the return values when I filled them in.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T05:25:00+00:00Added an answer on May 24, 2026 at 5:25 am

    If a ScaleGestureDetector is set up that returns false from onScaleBegin(…), none of the subsequent methods will be hit. Generally methods that consume a MotionEvent but return false do not get subsequent MotionEvents until after ACTION_UP, when the listeners are reset.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UPDATE: OK I figured it out, looks like fread has a filesize limitation, changed
Update II I Figured this out. When using google maps api, the model must
I am trying to figure out how I can update my sql query dynamically.
I'm trying to figure out a way to add a self-update feature to a
A puzzler from a coworker that I cannot figure out... update btd.dbo.tblpayroll set empname
I'm trying to do a simple update, but can't figure out somthing. I have
I'm trying to figure out why my web app (I didn't write it, but
UPDATE: Figured out some stuff and changed code. When I add my NSDictionary to
I'm trying to figure out an inconsistency between what's happening in a functional test
Update: Solved. See fix at bottom. In my iPad app which supports all orientations,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.