Question: ```
#include<stdio.h>
main()
{
  printf("%c\n",1-3+2["nexus"]);
}

```

The result is **v**. How does it turn out?  

What does the indentation (square ones) do?

Answer: 
use addOnBackStackChangedListener method in your BaseActivity, which will be called any time backstack changes

```
getSupportFragmentManager().addOnBackStackChangedListener(
            new FragmentManager.OnBackStackChangedListener() {
                public void onBackStackChanged() {
                    FragmentManager fm = getSupportFragmentManager();

                    if (fm != null) {
                        int backStackCount = fm.getBackStackEntryCount();
                        if (backStackCount == 0) {
                            if (getSupportActionBar() != null) {
                                getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_menu);
                            }
                            setToolbarTittle(R.string.app_name);
                        } else {
                            if (getSupportActionBar() != null) {
                                getSupportActionBar().setHomeAsUpIndicator(R.drawable.back);
                            }
                        }
                    }
                }
            });

```
There's also one other good [source](https://androidlearnersite.wordpress.com/2017/02/27/fragment-lifecycle-during-fragment-transaction/) that you can read through. 

I think, the important point is the difference of the transaction you performed on Fragment B. If it's **add**, then no lifecycle methods are called on **Fragment A**, if it's **replace**, you will get some calls on those methods.