Answer the question
In order to leave comments, you need to log in
When should you use an application class?
Here I have ViewModel() and Application(). The UI has onClickListener, it contains a function call that saves key-value data. The function that saves key-value data ( fun saveData(data: Boolean) { }
) should be in the ViewModel or in the Application?
Answer the question
In order to leave comments, you need to log in
Very rarely is it needed. For example, a DI root should grow from it. Also there can be all sorts of specific things, such as initializing the multidex, initializing the crash logging libraries, and loading native libraries.
The saveData function should definitely not be in it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question