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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:15:24+00:00 2026-05-27T01:15:24+00:00

why cant my fragments be added to back stack? @Override public void onTabSelected(Tab tab,

  • 0

why cant my fragments be added to back stack?

@Override
    public void onTabSelected(Tab tab, android.app.FragmentTransaction ft) {
        FragmentTransaction transaction = null;


            ListFragment newListFragment = new bListFragment();
            Fragment newFragment = new EntryFrag();
            transaction = getFragmentManager().beginTransaction();
            ft.replace(R.id.frameOne, newListFragment);
            ft.replace(R.id.frameTwo, newFragment);


        ft.addToBackStack(null);
        transaction.commit();
    }

logcat error

11-22 12:30:41.370: E/AndroidRuntime(13989): FATAL EXCEPTION: main
11-22 12:30:41.370: E/AndroidRuntime(13989): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tyczj.bowling/com.tyczj.bowling.Tabs}: java.lang.IllegalStateException: This FragmentTransaction is not allowed to be added to the back stack.
11-22 12:30:41.370: E/AndroidRuntime(13989):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1751)
11-22 12:30:41.370: E/AndroidRuntime(13989):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1767)
11-22 12:30:41.370: E/AndroidRuntime(13989):    at android.app.ActivityThread.access$1500(ActivityThread.java:122)
11-22 12:30:41.370: E/AndroidRuntime(13989):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1005)
11-22 12:30:41.370: E/AndroidRuntime(13989):    at android.os.Handler.dispatchMessage(Handler.java:99)
11-22 12:30:41.370: E/AndroidRuntime(13989):    at android.os.Looper.loop(Looper.java:132)
11-22 12:30:41.370: E/AndroidRuntime(13989):    at android.app.ActivityThread.main(ActivityThread.java:4028)
11-22 12:30:41.370: E/AndroidRuntime(13989):    at java.lang.reflect.Method.invokeNative(Native Method)
11-22 12:30:41.370: E/AndroidRuntime(13989):    at java.lang.reflect.Method.invoke(Method.java:491)
11-22 12:30:41.370: E/AndroidRuntime(13989):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
11-22 12:30:41.370: E/AndroidRuntime(13989):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
11-22 12:30:41.370: E/AndroidRuntime(13989):    at dalvik.system.NativeStart.main(Native Method)
11-22 12:30:41.370: E/AndroidRuntime(13989): Caused by: java.lang.IllegalStateException: This FragmentTransaction is not allowed to be added to the back stack.
11-22 12:30:41.370: E/AndroidRuntime(13989):    at android.app.BackStackRecord.addToBackStack(BackStackRecord.java:422)
11-22 12:30:41.370: E/AndroidRuntime(13989):    at com.tyczj.bowling.Tabs$TabListener.onTabSelected(Tabs.java:155)
11-22 12:30:41.370: E/AndroidRuntime(13989):    at com.android.internal.app.ActionBarImpl.selectTab(ActionBarImpl.java:483)
11-22 12:30:41.370: E/AndroidRuntime(13989):    at com.android.internal.app.ActionBarImpl.setSelectedNavigationItem(ActionBarImpl.java:303)
11-22 12:30:41.370: E/AndroidRuntime(13989):    at com.android.internal.app.ActionBarImpl.setNavigationMode(ActionBarImpl.java:883)
11-22 12:30:41.370: E/AndroidRuntime(13989):    at com.tyczj.bowling.Tabs.onCreate(Tabs.java:32)
11-22 12:30:41.370: E/AndroidRuntime(13989):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
11-22 12:30:41.370: E/AndroidRuntime(13989):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1715)
  • 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-05-27T01:15:25+00:00Added an answer on May 27, 2026 at 1:15 am

    Get rid of your transaction and, instead, use the FragmentTransaction provided in the callback. There’s no need to instantiate a new FragmentTransaction when one is already handed to you. Pass in whatever you want into your call to ft.addToBackstack(); and then call ft.commit();

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

Sidebar

Related Questions

Possible Duplicate: Separate Back Stack for each tab in Android using Fragments I've recently
I started trying to add fragments to my Android app, which is based on
I'm coding my first android app with fragments and here is my problem. I've
I'm a bit new to Android and very new to Fragments. I'm attempting to
I created an app with using fragmentactivity and alot of fragments.... Slddingdriwer's layout has
I am developing an Android app for tablets and not using the compatibility library.
I'm using the v4 android compatibility library to develop a tablet UI using fragments
Currently I have an app which works on Android 1.6 and above, works on
Cant seem to get the following to find the 'skull' button when the 'heart'
I cant post the code (proprietary issues) but does anyone know what types of

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.