I am having button that laid out in Linear Layout on Activity .
when I clicked on it, an message appear on screen using Toast Class
two methods works fine for me
first one is :
private void DisplayToast(String msg)
{
Toast.makeText(getBaseContext(), msg,
Toast.LENGTH_SHORT).show();
}
and the second one is :
private void DisplayToast(String msg)
{
Toast.makeText(this, msg,
Toast.LENGTH_SHORT).show();
}
my question is what is the deference between getBaseContext()
and this
,and when I should use getBaseContext()
and when I should use this
??