W
W
Wade2k2019-04-29 12:40:53
Android
Wade2k, 2019-04-29 12:40:53

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

1 answer(s)
D
Denis Zagaevsky, 2019-04-29
@zagayevskiy

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 question

Ask a Question

731 491 924 answers to any question