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.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Christophe Beyls
Christophe Beyls

Written by Christophe Beyls

Android developer from Belgium, blogging about advanced programming topics.

No responses yet

Write a response