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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:47:00+00:00 2026-06-14T23:47:00+00:00

In my application I have multiple fragments, but I am not been able to

  • 0

In my application I have multiple fragments, but I am not been able to switch between the fragments. When I click button1, it display the correct fragment. But when I click button2, it does not display the corresponding fragment.

Following is my relevant code:

fragmentM = getFragmentManager();
transation = fragmentM.beginTransaction();
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch(v.getId()){
case R.id.search:
break;
case R.id.btnun:
detail = new DetailFragment();
transation.add(R.id.fragment_container, detail);
transation.addToBackStack(null);
transation.commit();
break;
case R.id.btnch:
detailt = new DetailtFragment();
transation.replace(R.id.fragment_container, detailt);
transation.addToBackStack(null);
transation.commit();
break;
}
  • 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-14T23:47:02+00:00Added an answer on June 14, 2026 at 11:47 pm

    They appear to be different classes of Fragment so I think that’s ok.

    You should try and move the getFragmentManager.beginTransaction() lines to the start of the onClick method. It is my understanding that you need to get a new transaction every time you want to make a change.

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

Sidebar

Related Questions

I'm implementing a chat application. The user is able to have multiple chats open
In my application I have multiple not realtime games. In each game, each player
I am developing an application for Android 4.0.3. I have multiple fragments and I
In my iPad Application I have multiple views on a screen. What I want
In my application I have a customer who can have multiple locations. When you
I try to get the following done: A WPF application where i have multiple
so i'm trying to set up an application where i have multiple panels inside
_Hey, I have a question. I want to write application which will have multiple
We have multiple BizTalk 2006 application servers, and I find it almost impossible to
I have multiple filters in my application, with one at the root. <filter> <filter-name>root</filter-name>

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.