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 9186323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:29:52+00:00 2026-06-17T19:29:52+00:00

I have a TabActivity with 2 tabs that contain a control that responds to

  • 0

I have a TabActivity with 2 tabs that contain a control that responds to Scale and Scroll events.

When I fire up my app to begin with it starts on Tab 1 and I can scale and scroll the view shown on the 1st Tab’s activity.

When I switch to Tab 2 again I can scale and scroll the view shown on the 2nd tab’s activity.

All looks good.

When I switch back to the 1st tab suddenly I can no longer scale or scroll. If i switch back to the 2nd again then that one works fine. Its as if the touch focus is being taken by the view on the 2nd tab and never being surrendered.

I’ve even tried re-initialising my GestureDetectors in case they somehow get destroyed when one Activity gets backgrounded.

I’ve tried the following code to no avail:

public void onPause()
{
    super.onPause();
    mView.clearFocus();
}

public void onResume()
{
    super.onResume();
    mView.requestFocus();
    mView.InitGestureDetectors( this );
}

Where InitGestureDetectors simply does the following:

public void InitGestureDetectors( Context ctx )
{
    mScaleGestureDetector   = new ScaleGestureDetector( ctx, new ScaleGestureListener() );
    mGestureDetector        = new GestureDetector( ctx, new GestureListener() );
}

Can anyone tell me how I can get my touch gestures working again when i subsequently switch tabs?

  • 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-06-17T19:29:54+00:00Added an answer on June 17, 2026 at 7:29 pm

    I’ve eventually tracked down the source of my problems. This was being caused by a custom OnTabChangeListener used to create a transition animation when you change tabs. This caused, for some reason, the visibility state to not get set to GONE when a view moved into the background. So i added a custom AnimationListener to set the visibility flag appropriately in onAnimationEnd and onAnimationStart.

    outAnim.setAnimationListener( new Animation.AnimationListener()
    {
        public void onAnimationEnd( Animation animation )
        {
            outView.setVisibility( View.GONE );
        }
    
        public void onAnimationRepeat( Animation animation )
        {
        }
    
        public void onAnimationStart( Animation animation )
        {
            inView.setVisibility( View.VISIBLE );
        }
    } );
    

    and now my touch events are being handled as I would expect!

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

Sidebar

Related Questions

I have a TabActivity that has three tabs. The fist tab is the problem.
I have a TabActivity that has a TabHost with two tabs. Each tab has
i have a tabActivity that hold 3 tabs. from one tab i want to
I have a TabActivity with three tabs defined. The first tab is light-weight and
So, in my program i have a TabActivity which contains two tabs, one tab
In my Android app I have a TabActivity, with 3 tabs. In one of
My problem is, that I have got a TabActivity, which has 4 Tabs right
I have a TabActivity with 3 tabs. There is an async task that when
I have an android app that extends a MapActivity, so I can't extend TabActivity.
I have an application that is a Tab activity with various tabs that load

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.