Let's add logging to the lifecycle methods to see what's happening behind the scenes in CalculatorActivity, CalculatorApplication, ButtonFragment, and DisplayFragment.
So that we can easily identify our log messages, add a constant field to each class:
private static final String TAG = "Lifecycle " + [ClassName].class.getSimpleName();
Make sure to replace [ClassName] with the name of the class (e.g. CalculatorApplication).
Use ⌘O to override the lifecycle functions.
Add a log call in each method. For example, your onCreate() should look like this:
@Override
public void onCreate( Bundle savedInstanceState )
{
super.onCreate( savedInstanceState );
Log.d(TAG, "onCreate()");
...
}
You can filter the IntelliJ logs to show only a specific tag (the first string provided to Log.d()):
