L
L
Lord Drous2017-10-22 16:00:36
Java
Lord Drous, 2017-10-22 16:00:36

How to monitor the exit from the application in a specific activity?

Hello. I need to be able to catch the name of the screen in which the user completely closed the application. To do this, I created the App class and inherited from Application, and created an enum. but onDestroy doesn't work(cannot resolve method onDestroy)
59ec966f5e56e150987089.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Zagaevsky, 2017-10-22
@zagayevskiy

In android, there is no concept of completely exiting the application. You can hang a listener on the life cycle and track that all Activities have stopped (onDestroy is not guaranteed).
onDestroy is the Activity method, and in your example you are trying to override it in the application.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question