K
K
kirawa2018-02-14 09:57:12
Android
kirawa, 2018-02-14 09:57:12

Why does a fragment overlap with another?

Good afternoon. Sometimes I overlap one fragment with another. I haven't been able to pinpoint the cause yet. How can this be processed?
Maybe it's because I call getFragmentManager wherever necessary, but I need to initialize it at the beginning of the fragment's life cycle? And so I do replace or popBackStack everywhere. Often this error is reproduced when I switch from some fragment to another using the side menu, for example, calling:

fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
            fragmentManager.beginTransaction()
                    .replace(R.id.contentMain, new SettingsFragment())
                    .commit();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Yudakov, 2018-02-14
@AlexanderYudakov

popBackStack()
popBackStackImmediate()

Like popBackStack(String, int), but performs the operation immediately inside of the call. This is like calling executePendingTransactions() afterwards without forcing the start of postponed Transactions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question