You can, in addition to this
, get the context in various ways, with different methods. As shown in the code below, we have getApplicationContext()
and getBaseContext()
that apparently has the same purpose.
public class MainActivity extends AppCompatActivity{
public Context context;
public void umMetodoQualquer() {
context = this;
context = getApplicationContext();
context = getBaseContext();
}
}
And in practice, what are the differences between methods for getting context?