in Education by
My application crashes whenever my location is changed. Application structure is simple: there is one Activity and a many fragments. Conclusion fragment is carried out as follows: ItemsFragment itemsFragment = new ItemsFragment () {GroupID = groupID, CurrentGroup = currentGroup}; itemsFragment.RetainInstance = true; var fragmentManager = SupportFragmentManager.BeginTransaction (); fragmentManager.Replace (Resource.Id.flContent, (SupportFragment) itemsFragment); fragmentManager.AddToBackStack (null); fragmentManager.Commit (); I use C # Xamarin, but java principle is the same, only slightly different syntax. Help a newbie android-developers to understand the reason. On the mobile device produces an error: “Unfortunately App has Stopped” Where only can be put try... catch and got this error: Java.Lang.IllegalStateException: Can not perform this action after onSaveInstanceState JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
The reason is that you are sometimes replacing fragments after your Activity has paused. The easiest way to fix it is to use fragmentManager.CommitAllowingStateLoss(); As @user13 mentioned, it is the easiest, and the worst way. If you want a good solution, you should check if the Activity state is Ok to replace fragment before actually replacing it

Related questions

0 votes
    I have an app that was designed for the Google 2.2 api (it includes maps) and I want to make it ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    I'm designing a service that will comprise a cloud-based database (with a UI for us to manage the data), ... sit behind mobile apps. Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    Is there a way to know who is the application caller? These are several use cases cases: I have ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jan 16, 2022 in Education by JackTerrance
0 votes
    I found the following piece of code from the adw launcher: Object service = launcher.getSystemService("statusbar ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jan 13, 2022 in Education by JackTerrance
0 votes
    In my app I'm using a spinners to let the user select an item from a list. Everything works fine ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    I'm making a new Android project, with the standard 'app' module, as well as a library project ( ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I'm trying to run a simulation that involves a large amount of calculations and values. I've got ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 14, 2022 in Education by JackTerrance
0 votes
    I have written a piece of code to validate a keyword, it validates and makes sure that the word is 5 letters long and ... the problem, as it works fine without it. The code: cout...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Aug 1, 2022 in Education by JackTerrance
0 votes
    Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle. ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I made a website and turned it into Android app, using Phonegap website. I have files stored on a ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 11, 2022 in Education by JackTerrance
0 votes
    I'm using SafetyNet API for checking if device is rooted or not and using the below helpful code but ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 19, 2022 in Education by JackTerrance
0 votes
    I want to know whether the user allows autostart permissions of the app. I have already tried this: ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 10, 2022 in Education by JackTerrance
0 votes
    I'm having a problem with my logcat since update 1.2 Beta for Android Studio. When I run my app ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 14, 2022 in Education by JackTerrance
0 votes
    I am creating an Android app that will download and cache PDF files (the files are for issues of ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
...