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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:16:55+00:00 2026-06-10T02:16:55+00:00

Im sure this question is pretty basic but im new. Now I have a

  • 0

Im sure this question is pretty basic but im new.
Now I have a FragmentTransaction under my main activity (see it below), I would like to be able to perform “replace” from within one of these fragments. I believe it would involve getActivity() but im not really sure about how to do that?

It would be nice if anybody could give me an example, thanks in advance 🙂

public void onTabSelected(Tab tab, FragmentTransaction ft) {
    {
        if(tab.getPosition()==0)
        {
        firstFragment frag = new firstFragment();
        ft.replace(android.R.id.content, frag);
        }
        else if(tab.getPosition()==1)
        {
        newsFragment frag = new newsFragment();
        ft.replace(android.R.id.content, frag);
        }
        else if(tab.getPosition()==2)
        {
        thirFragment frag = new thirFragment();
        ft.replace(android.R.id.content, frag);
        }
        else if(tab.getPosition()==3)
        {
        calendar frag = new calendar();
        ft.replace(android.R.id.content, frag);
        }
        else if(tab.getPosition()==6)
        {
        linksFragment frag = new linksFragment();
        ft.replace(android.R.id.content, frag);
        }
        else if(tab.getPosition()==5)
        {
        contactFragment frag = new contactFragment();
        ft.replace(android.R.id.content, frag);
        }
        }


}
  • 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-10T02:16:57+00:00Added an answer on June 10, 2026 at 2:16 am

    TO use the fragment transaction you do this :

                    FragmentManager fmu = getSupportFragmentManager();
                    FragmentTransaction ftu = fmu.beginTransaction();
                    RSSFragment rssfrag;
                    ftu.replace(R.id.frame_fragment, rssfrag).commit();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is pretty basic question I am sure but it's baffling me now :S
I'm pretty sure this is a basic question, but I can't find the answer
I'm pretty sure this is a basic question but for some reason i can't
I'm pretty sure this is a basic question but for some reason i can't
I am pretty sure that this is a very basic question, but I am
I'm pretty sure that this is a basic question but I really don't know
This, I'm sure is a pretty basic question about JavaScript, so apologies in advance.
This is probably a really newbie question (well, I'm pretty sure it is), but
I think this is a pretty basic question, but here it is anyway. I
I'm sure I'm missing something pretty basic, but I have just started to get

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.