【发布时间】:2016-01-07 19:51:50
【问题描述】:
我的设备运行的是 Android 5.1.1,我发现如果我使用的话
Toast.makeText(this, "This is a toast", Toast.LENGTH_SHORT).show();
我知道了:
但如果我使用getApplicationContext() 而不是this,
Toast.makeText(getApplicationContext(), "This is a toast", Toast.LENGTH_SHORT).show();
我知道了:
两者都直接从活动中调用。
这是为什么?
【问题讨论】:
标签: android android-context android-toast android-5.1.1-lollipop