我有一个广播接收器,我正在尝试从中显示一条 toast 消息,这可能吗? 此代码不显示 toast,但会在 logcat 中打印日志消息。我在做一些愚蠢的事情还是我的问题是什么?
@Override
public void onReceive(Context context, Intent intent) {
Log.v("log", "this is shown");
Toast.makeText(context, "this is not shown" , Toast.LENGTH_LONG);
}
最佳答案
为 Toast
调用 show()
方法。
关于android - 来自广播接收器的 Toast 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7900976/