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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:11:11+00:00 2026-06-07T12:11:11+00:00

I have an activity with 3 fragments displayed, a MapActivity , a ListActivity ,

  • 0

I have an activity with 3 fragments displayed, a MapActivity, a ListActivity, and a (normal) DetailsActivity. The ListActivity and DetailsActivity is placed over the MapActivity.

There’s a function to hide both ListActivity and DetailsActivity with an Animation, and onAnimationEnd() I set a new layout for the hidden Activity.

The problem I’m facing is, everytime one of the ListActivity or DetailsActivity hidden (picture State 2), and then I pinch the screen on the MapActivity to zoom the map, it always goes back to the default view (picture State 1). The closed Activities are automatically opened again.

Does anybody know how to prevent the hidden fragments from going to the first state again when I pinch the MapActivity?

this is an example of the function how I hide the DetailsActivity():

public void hideDetailview() {
        final Animation close = AnimationUtils.loadAnimation(this, R.anim.close);
        close.setFillEnabled(true);
        close.setAnimationListener(closeDetailAnimationListener);
        fragment_detail.startAnimation(close);

        Toast.makeText(MainFragmentActivity.this,WWHApplication.getDrawer(), Toast.LENGTH_SHORT).show();
    }

    private AnimationListener closeDetailAnimationListener = new AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {

        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {


            int newLeft = -330;
            fragment_detail.layout(newLeft, 
                    fragment_detail.getTop(), 
                                newLeft + fragment_detail.getMeasuredWidth(), 
                                fragment_detail.getTop() + fragment_detail.getMeasuredHeight());

        }
    };

Here’s the xml layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res/com.wwh"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <fragment
        android:id="@+id/my_map_fragment1"
        android:name="com.wwh.fragments.MyMapFragment"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <!-- Preview: layout=@layout/my_map_fragment -->
    </fragment>

    <RelativeLayout
        android:id="@+id/fragment_layout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="55dp"
        android:orientation="horizontal" >

        <LinearLayout
            android:id="@+id/detail_layout"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:orientation="horizontal" >

            <fragment
                android:id="@+id/my_detail_fragment"
                android:name="com.wwh.fragments.DetailFragment"
                android:layout_width="380dp"
                android:layout_height="fill_parent" />

            <LinearLayout
                android:id="@+id/border_detail"
                android:layout_width="1dp"
                android:layout_height="fill_parent"
                android:background="@drawable/border"
                android:orientation="vertical" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/list_layout"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_toRightOf="@+id/detail_layout"
            android:orientation="horizontal" >

            <fragment
                android:id="@+id/my_list_fragment"
                android:name="com.wwh.fragments.MyListFragment"
                android:layout_width="380dp"
                android:layout_height="fill_parent"
                android:background="@drawable/border"
                android:shadowColor="#000000"
                android:shadowDx="1.2"
                android:shadowDy="12"
                android:shadowRadius="12" />

            <LinearLayout
                android:id="@+id/border_list"
                android:layout_width="1dp"
                android:layout_height="fill_parent"
                android:background="@drawable/border"
                android:orientation="vertical" />

            <ImageView
                android:id="@+id/shadow_vertical"
                android:layout_width="2dp"
                android:layout_height="fill_parent"
                android:layout_marginTop="53dp"
                android:background="@drawable/shadow_vertical" />
        </LinearLayout>
    </RelativeLayout>

</RelativeLayout>

The normal default state, all fragments are opened

Second state, fragments are closed

  • 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-07T12:11:13+00:00Added an answer on June 7, 2026 at 12:11 pm

    you’ve forgot to update the layout of the other fragments , perhaps?or maybe , you’ve got the wrong calculation of the new layout ?

    i say this since animations on old android versions are tricky since they don’t really change the layout of the views . so maybe when animation ends , you actually touch on something that you don’t think you’re touching .

    please provide more code . maybe it could help us understand why it occurs.

    btw , please rename the fragments classes . they are not activities , so why have “activity” in their names?

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

Sidebar

Related Questions

I have an Activity that has 2 fragments. Both are ListFragments and both contribute
I have an activity with 2 fragments. I have added custom animations for fragment
I've just started converting my apps to use fragments. I have a ListView activity
can i use fragments and map view in the same activity. I have seen
I have an activity(say, MyActivity) that contains fragments, and i am using fragmentTransaction.replace(XX,YY) for
I need your help. I have one Activity with two fragments: one fragment with
I have created display using Fragments , both of which is being populated with
I have an activity with two fragments: one for showing products in a grid
I have an Activity which uses a Fragment . I simply want to pass
I have a very simple activity just to show the preference fragment: public class

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.