A
A
Az-Su2021-04-22 14:41:29
Android
Az-Su, 2021-04-22 14:41:29

How can we see Activity without creating OnStart and OnResume methods?

I created an empty file with only Hello World . I wanted to see how the activity life cycle works, but I noticed that MainActivity only has an overridden OnCreate method . And at startup, we accordingly see the Activity itself (that is, at the OnResume level ).
The question is, how can we see it without calling these methods?? (only the OnCreate method is called )
608160e6015dd751973425.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Vodakov, 2021-04-22
@Az-Su

No, you are wrong. All the necessary methods are there and called. It's just that they are not overridden, which means they are used inherited from AppCompatActivity, look for them there.
You can see the life cycle either in the debugger, or by overriding all the necessary methods. In the body of the overridden methods, call them from the parent class via super and add your logs, or whatever you want there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question