2

Here is a similar question but I think it is not identical

And I read Setting up request queue tutorial here

In this page they write the following code

public class MySingleton {
   private static Context mCtx;

And I wrote same code in my project

public class VolleySingleton {
  private static Context mContext;

Android studio say “Do not place Android context classes in static fields; this is a memory leak”.
What does it mean? And why dos the official android developer website use such kind of code?

TT--
  • 2,956
  • 1
  • 27
  • 46
Nyein Chan
  • 1,215
  • 2
  • 17
  • 32
  • use Application context when use singeton else leaking – hemen Jan 06 '18 at 13:24
  • (Originally flagged as) Possible duplicate of [Do not place Android Context classes in static fields](https://stackoverflow.com/questions/39868001/do-not-place-android-context-classes-in-static-fields-this-is-a-memory-leak) but a **better Possible duplicate** is [Warning do not place Android Context classes in static fields](https://stackoverflow.com/questions/40094020/warning-do-not-place-android-context-classes-in-static-fields-this-is-a-memor) – TT-- Jul 16 '19 at 19:39

0 Answers0