When we build an app, we need to consider what should the app do if it is paused or reversely. So, how can we know the app is paused or resumed? There is a simple method to know it.

Firstly, we need to create onResume() and onPause() methods, when the app is paused, the onResume() will be called automatically, it is the same story on onPause() method. Then, create a log() method. When either onPause() or onResume() is called, the log method will be called with the parameter value. After the log method received the parameter value, the parameter value will be shown through StringBuilder. The textView is for showing the app status. Thus, the StringBuilder is set into textView.