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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:53:26+00:00 2026-06-09T08:53:26+00:00

Now I am doing an application using fragments. So i care a fragment activity

  • 0

Now I am doing an application using fragments.
So i care a fragment activity with four fragments fragment A,fragment B, fragment C, Fragment D.
By default Fragment A will be selected and on tab click I can switch to fragment B,C,D or A.

My problem is I want to check a condition in fragment A and depends on result switch to fragment B.Like.

Intent in=new Intent(src,destination);
startactivity(in)

I want to switch to other fragment without clicking tab button.Following is the code i used to add fragment.I want to check a condition depends on that condition fragment a,fragment b tab will selected

 ActionBar bar = getSupportActionBar();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    ActionBar.Tab tab1 = bar.newTab();
    ActionBar.Tab tab2 = bar.newTab();
    tab1.setText("Fragment A");
    tab2.setText("Fragment B");
    tab1.setTabListener(new MyTabListener());
    tab2.setTabListener(new MyTabListener());
    bar.addTab(tab1);
    bar.addTab(tab2);

please help me friends.

  • 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-09T08:53:27+00:00Added an answer on June 9, 2026 at 8:53 am

    If by selecting a tab you can switch to a certain fragment e.g tab1 brings up Fragment A, then all you need to do is select that tab. For example your currently viewing Fragment B and need to check some condition which will determine whether you switch to Fragment A or C

    ActionBar bar = getSupportActionBar();
    if(condition){
        bar.setSelectedNavigationItem(1); //where 1 is the position of tab1
    }else{
        bar.setSelectedNavigationItem(3); //for tab3
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Now i am doing an android application.In that application I am using asynchtask class
I am doing lot of desktop application but using .Net WinForm. But now for
Now I am doing an application.In my app I have to change textview value
I have a problem here. Right now I'm doing my Web Based Application, my
I'm now doing this: rewriterule ^jobs/([0-9]+)/.* job.php?id=$1 Which will erase parameters in jobs/1010/title?k=v How
I've got a server application using select.select(), and now I'm trying to add SSL
I am creating an iPad application using a UISplitView. I used the default template
i'm doing an application with ajax using jQuery and some other tools, and in
I have an application doing XML<->conversions using Jaxb and automatically generated classes with maven-jaxb2-plugin.
I am doing Multimedia application using client server interaction, for that i uploaded some

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.