ActivityName.this refers to an activity context. getApplicationContext () refers to the application context.
In most cases, it is better to use an activity context.
Check out the answer provided by commonsware. Detailed explanation on this topic.
When to call an activity context or application context?
Quote from the link above
Here are reasons why not use getApplicationContext () wherever you go:
This is not a complete context that supports all actions. The various things you try to do with this Context will fail, mainly related to the GUI .
It can create memory leaks if the Context from getApplicationContext () rests on something created by your calls on it that you are not clearing. With Activity, if it rests on something, as soon as the Activity receives garbage collection, everything else is also dumped. The Application object remains during the lifetime of your process.
source share