【发布时间】:2015-08-18 20:21:35
【问题描述】:
我的 MainActivity 扩展了 FragmentActivity。我在按钮的 SetonClickListener 的 onCreate 方法中有一个 Toast.makeText。吐司没有出现。我使用了 getApplicationContext()、MainActivity.this、getApplication()。一切都失败了。我尝试在我的设备上打开此特定应用的应用通知,但没有成功。
编辑
我忘了使用 show() 方法。感谢 shobhit
【问题讨论】:
-
你能把代码片段贴出来看看你是怎么称呼它的吗?你可以试试
MainActivity.this并删除getApplication()吗?还要确保你在上面调用.show()。比如:Toast.makeText(MainActivity.this, "Message", Toast.LENGTH_LONG).show(); -
请发布您的代码
-
感谢 Shobhit,我忘了使用 show() 方法。
标签: android android-fragments android-fragmentactivity