Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. private Context context;
  2.  
  3. public void setContext(Context context) {
  4. this.context = context;
  5. }
  6.  
  7. lateinit var context: Context
  8.  
  9. object Singleton {
  10. lateinit var context : Context
  11.  
  12. }
  13.  
  14. Do not place Android context classes in static fields (static reference to `Singleton` which has field `context` pointing to `Context`); this is a memory leak
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement