2

In a lot of examples, I notice that that they are created like this:

Toast.makeText(getApplicationContext(), "Toast Text", Toast.LENGTH_SHORT).show();

Generally, it has been my habit to just use the 'this' keyword for the Activity I am in and it works perfectly fine.

Is there any compelling argument for using application context?

Maximus
  • 8,061
  • 3
  • 27
  • 37

1 Answers1

2

The previous answer is simply not correct. Check out CommonsWare's answer to this question at this similar post:

When to call activity context OR application context?

You most often WANT to use 'this' (which is the Activities context).

Community
  • 1
  • 1
SBerg413
  • 14,046
  • 6
  • 55
  • 87