Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FragmentManager popBackStack does not work - Bug?

I am using this code to clear up my backstack up to my main view:

while(mFragmentManager.getBackStackEntryCount() > 1) {
            mFragmentManager.popBackStack(null, 0);
}

I am pretty sure this code was working before, but now the backstack count does not change and no Fragment is being removed, which causes an out of memory exception because the while loop keeps running.

Does anyone know, if there is something wrong with it, or if there is a bug in the latest revision of the SDK-tools. I have no clue what's causing the problem.

like image 521
Nickolaus Avatar asked Jan 22 '13 10:01

Nickolaus


1 Answers

You are probably looking for popBackStackImmediate(). This immediately executes a back stack pop.

like image 171
cdeange Avatar answered Sep 20 '22 01:09

cdeange