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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:56:25+00:00 2026-06-02T14:56:25+00:00

My simple layout only has a fragment placeholder: <FrameLayout android:id=@+id/fragment_placeholder android:layout_width=fill_parent android:layout_height=fill_parent /> I

  • 0

My simple layout only has a fragment placeholder:

<FrameLayout
   android:id="@+id/fragment_placeholder"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
  />

I firstly add a 1st fragment to this placeholder:

fragmentTransaction.add(R.id.fragment_placeholder, firstFragment, "first"); //I did not put to backstack

I have a 2nd fragment, which replace the above fragment and put it to back stack:

FragmentManager fragMgr = getSupportFragmentManager();
FragmentTransaction fragTrans = fragMgr.beginTransaction();

//initialize an fragment instance
Fragment secondFragment = initSecondFragment(); 

//replace with the fragment 
fragTrans.replace(R.id.fragment_placeholder, secondFragment, "second");

//Add fragment transaction to back stack
fragTrans.addToBackStack(null);

//commit the transaction
fragTrans.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
fragTrans.commit();  

Later I have some fragments replace the previous fragment, but NOT put on backstack.

It seems for those fragment which have not been put on backstack will always showing on screen, the back button press will have not effect to them.

So, How to find those fragments which are not on backstack in my app, and how to remove them from screen?

  • 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-02T14:56:27+00:00Added an answer on June 2, 2026 at 2:56 pm

    How to find those fragments which are not on backstack in my app

    Call findFragmentById() or findFragmentByTag() on your FragmentManager.

    how to remove them from screen?

    Use remove() with a FragmentTransaction.

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

Sidebar

Related Questions

I have to make a simple layout in android but have problem with the
My main layout main.xml has only a Button , a EditText and an empty
My application currently has a very simple URL layout: map.resource :account, :controller => users,
I built a simple, once screen android app - it has edittext boxes for
I have created a simple layout using the HTML div tag. I would like
I have a fairly simple layout with an image, and some textviews wrapped in
I'm trying to build the simple layout that I have got in the image
For a simple chat application, I thought of using this simple layout: *----------------------------------* |<div>
Working on a rather small, and simple layout, I decided to use Meyer's CSS
I have a simple page layout with two divs--one on top, and one on

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.