Christophe Beyls
1 min readFeb 11, 2020

--

Of course on Android you must never keep a static reference to any Context, except for the Application Context. The singletons I describe here are meant to be scoped for the global application, not a specific Activity or Service.

Furthermore, even if it’s safe to keep a reference to the Application Context, I would recommend to only use a Context argument to fetch some configuration during the initialization of the instance, and not keeping the reference forever if you can avoid it.

--

--

Christophe Beyls
Christophe Beyls

Written by Christophe Beyls

Android developer from Belgium, blogging about advanced programming topics.

No responses yet