从广播接收机吐司消息 [英] Toast message from Broadcast Receiver
本文介绍了从广播接收机吐司消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个广播接收器,我试图从它显示敬酒消息,这可能吗? 这code不显示敬酒,但它在打印的logcat日志消息。有一些愚蠢的事情我做或什么是我的问题?
@覆盖
公共无效的onReceive(上下文的背景下,意图意图){
Log.v(日志,这显示);
Toast.makeText(背景下,这是不是显示,Toast.LENGTH_LONG);
}
解决方案
致电显示()
方法为吐司
。
I have a broadcast receiver and I am trying to show a toast message from it, is this possible ? This code doesn't show the toast but it print the log message in the logcat. Is there some idiotic thing I am doing or what is my problem ?
@Override
public void onReceive(Context context, Intent intent) {
Log.v("log", "this is shown");
Toast.makeText(context, "this is not shown" , Toast.LENGTH_LONG);
}
解决方案
Call the show()
method for the Toast
.
这篇关于从广播接收机吐司消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文