This is really not a question but I have always been unsure which context to use. In B4A, we have ba.context and also ba.applicationContext. When you wrap a library, you can often deduce which context to use from the code you are wrapping. But if you want to write your own library from scratch??
This
answer on SO from CommonsWare suggests that getApplicationContext() is almost always wrong. I found also
this guide (although from 2013) but probably still valid which I found quite useful to get a better understanding although I still haven't grasped everything:
How do you reason when you need to use a context? Do you have a simple rule?
EDIT: I found
this reply from Erel which probably summons it up nicely..