I´m trying to show a Toast on ProgressUpdate() method. Works well on Android 4,5 but the toast is not shown on android 6 and no exceptions are thrown.
Here is my method:
@Override
protected void onProgressUpdate(String... values) {
super.onProgressUpdate(values);
Toast.makeText(getApplicationContext(), values[0], Toast.LENGTH_SHORT).show();
}
If I replace getApplicationContext() with getBaseContext(), the Toast works as expected.
It does not work if I use MainActivity.this as context
Is it correct to use getBaseContext() ? Why works with getApplicationContext() on android 4,5 and not on 6?