Answer the question
In order to leave comments, you need to log in
How to organize a call to frequently used functions in android?
I am writing an application for android - the question arose of how to reuse a set of my functions? For example, make a singleton static and call it from all activities or services? I started reading about DI, but I didn’t immediately understand how it works.
Maybe there is a standard solution?
Answer the question
In order to leave comments, you need to log in
Yes, just like in regular Java, singletons work. Only a singleton is evil and an anti-pattern. Don't store views, context, and so on in a singleton.
And there would be more examples of such necessary functions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question