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

  • Home
  • SEARCH
  • 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 9313579
In Process

The Archive Base Latest Questions

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

I start my application first time, everything works clean. I finish my activity using

  • 0

I start my application first time, everything works clean. I finish my activity using finish().

After this, I start my application again and it crashes with this log:

02-19 15:33:16.652: E/AndroidRuntime(1859): FATAL EXCEPTION: main
02-19 15:33:16.652: E/AndroidRuntime(1859): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fileexplorermanager/com.landa.fileexplorermanager.MainActivity}: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
02-19 15:33:16.652: E/AndroidRuntime(1859):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
02-19 15:33:16.652: E/AndroidRuntime(1859):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
02-19 15:33:16.652: E/AndroidRuntime(1859):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
02-19 15:33:16.652: E/AndroidRuntime(1859):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
02-19 15:33:16.652: E/AndroidRuntime(1859):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-19 15:33:16.652: E/AndroidRuntime(1859):     at android.os.Looper.loop(Looper.java:137)
02-19 15:33:16.652: E/AndroidRuntime(1859):     at android.app.ActivityThread.main(ActivityThread.java:5039)
02-19 15:33:16.652: E/AndroidRuntime(1859):     at java.lang.reflect.Method.invokeNative(Native Method)
02-19 15:33:16.652: E/AndroidRuntime(1859):     at java.lang.reflect.Method.invoke(Method.java:511)
02-19 15:33:16.652: E/AndroidRuntime(1859):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-19 15:33:16.652: E/AndroidRuntime(1859):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-19 15:33:16.652: E/AndroidRuntime(1859):     at dalvik.system.NativeStart.main(Native Method)
02-19 15:33:16.652: E/AndroidRuntime(1859): Caused by: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
02-19 15:33:16.652: E/AndroidRuntime(1859):     at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1327)
02-19 15:33:16.652: E/AndroidRuntime(1859):     at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1338)
02-19 15:33:16.652: E/AndroidRuntime(1859):     at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:595)
02-19 15:33:16.652: E/AndroidRuntime(1859):     at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:574)
02-19 15:33:16.652: E/AndroidRuntime(1859):     at com.landa.features.BrowseHandler.populateContent(BrowseHandler.java:137)
02-19 15:33:16.652: E/AndroidRuntime(1859):     at com.landa.features.BrowseHandler.openFile(BrowseHandler.java:98)
02-19 15:33:16.652: E/AndroidRuntime(1859):     at com.landa.fileexplorermanager.MainActivity.onCreate(MainActivity.java:33)
02-19 15:33:16.652: E/AndroidRuntime(1859):     at android.app.Activity.performCreate(Activity.java:5104)
02-19 15:33:16.652: E/AndroidRuntime(1859):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
02-19 15:33:16.652: E/AndroidRuntime(1859):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
02-19 15:33:16.652: E/AndroidRuntime(1859):     ... 11 more

It appears the problem is populateContent() function which calls FragmentManager’s commit – that’s the line it’s failing on:

public void populateContent(File f)
{
    FragmentTransaction transaction = ac.getSupportFragmentManager().beginTransaction();
    ContentFragment cf = new ContentFragment(ctx, ac, this, f);

    transaction.replace(R.id.contentFragment, cf);
    transaction.addToBackStack(null);

    updateShownPath(f.getPath());
    transaction.commit();
}

Now, I have no idea why would an application work fine the first time, then finish(), then crash on 2nd start.

Any hints?

Note: I do have one fragment in FragmentManager before finishing the app (ALWAYS) – that’s the home fragment.

This is the onCreate():

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    initialiseApplication();

    browseHandler.openFile(new File(BrowseHandler.current_path));

}
  • 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-19T01:55:11+00:00Added an answer on June 19, 2026 at 1:55 am

    It seems the reason for this error that you are calling commit in a context that already got destroyed i.e. Activity that finished.

    Make sure that your ctx variable refers to an active Activity. Alternatively, you might want to keep your Activity in the background instead of manually finishing it.

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

Sidebar

Related Questions

My application should load some data when it start at first time, but it
I have application which when start I run MainActivity and after get some data
This is the first time I've used Node.js and Mongo, so please excuse any
Starting form now, for the first time, I am getting this error when I
in my application I call startActivityForResult( new Intent(this, ShowPreferencesActivity.class), <some code>); the activity is
I've never done a Java Web start application before. I wrote my app's JNLP
I have a Java Web Start application. I specify the resource (jars, images, etc)
I don't know how make my application as auto start application.That is my expectation
I'm going to develop a java web start application, which need to access protected
On application start I'm creating Config object (Singleton). How could I make Config object

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.