This activity is about life cycle on Android, I read several materials but still lost? Can someone please explain it?
Take a look here: link
Explain in more detail what I mentioned in my last comment. But basically the logic is you use System.currentTimeMillis () to save time frames that you will want to measure: when the Activity starts, when it pauses, etc.
To measure the time passed between these frames, just take the difference between them, which will be a value in milliseconds, then just convert to the unit you want (minutes, seconds, etc.).