A
A
Artyom2014-03-10 15:41:43
Android
Artyom, 2014-03-10 15:41:43

Android - Is there a way to run a method every time the application starts and every time it ends?

At startup, I would like to check the purchased goods, and at the end, also reset the settings. How to do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AgentSIB, 2014-03-10
@Dracontis

Create a class that extends Application and override the required methods (onCreate, onTerminate). Specify the full path to your class in AndroidManifest.xml instead of the application tag (for example, com.test.yaska.MyApplication).

M
Mintormo, 2014-03-10
@Mintormo

The onCreate method of the activity. At startup, it is called, you can check the list of goods. Each time the activity is destroyed, the on Destroy method is called. However, this is not guaranteed. Therefore, it is worth checking the list of products when starting the application and the presence of old settings. If they are, reset them.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question