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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:42:36+00:00 2026-06-10T15:42:36+00:00

I have one container root in main.xml. In that container I have added two

  • 0

I have one container root in main.xml.
In that container I have added two fragments “Transaction” and “balance”.
Basically after adding transaction balance should be updated and “transaction” fragment should be replaced with “Stats” Fragment.

Currently I am using the replace like :

FragmentTransaction ft = fm.beginTransaction();
ft.replace(R.id.root, BalFrag).commit();

But above code is removing the “balance” fragment and adding new one after “transaction” fragment.

  • 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-10T15:42:38+00:00Added an answer on June 10, 2026 at 3:42 pm

    Using 2 Fragments in a single container sounds like a bad idea to me but I think you should be able to replace just one fragment using something like

    FragmentManager fm = getFragmentManager();
    Fragment oldFragment = fm.findFragmentByTag("transaction"); // or keep a reference to it.
    Fragment newFragment = getNewFragment() // whatever you do to get a fragment instance
    
    FragmentTransaction ft = fm.beginTransaction();
    ft.remove(oldFragment);
    ft.add(R.id.root, newFragment, "Stats");
    ft.commit();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UIView container that has two UIImageView s inside it, one partially
Let say we are in landscape and I have one root container in that
I have a Grid as a root container with two columns defined (There's only
If I'm creating a universal iPhone/iPad app, I have two XIBs. One main XIB
I have two tables, one table is the items container, which holds all data
I have a couple of div elements contained in one container div , and
Possible stupid question: let's say I have two apps contained within one project. Can
Ok. I have a mainframe which contains two containers. One contains my wizard-alike buttons
I have one tabview which contain two different tab(subject and chapter) and i need
Here is my situation: I have one table that contains a list of drugs

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.