如何展示活动组中的警报?

编程入门 行业动态 更新时间:2024-10-19 19:35:01
本文介绍了如何展示活动组中的警报?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经在我的应用程序标签栏,并保持它,我已经使用活动组。在点击这些标签我必须表现出一系列的活动。我的问题是,我不能够显示一个警告对话框,或这些活动中的任何其它对话框。发生错误说无法添加窗口。谁能告诉怎么解决这个问题呢?

I have a tab bar inside my app and to maintain it I have used activity group. On clicking these tabs I have to show a set of activities. My problem is I am not able to show an alert dialog or any other dialogs inside these activities. An error occurs saying "unable to add window". Can anyone tell how to solve this issue?

推荐答案

它给上述错误的语境,因为我提供给alertdialog建设者。

It gives above error because of the Context I was providing to alertdialog builder.

给出:

新AlertDialog.Builder(的getParent())setMessage(世界,你好)显示();

new AlertDialog.Builder(getParent()).setMessage("Hello world").show();

我们只需要调用的getParent(),而不是AlertDialog.Builder(本)

We just need to call getParent() instead of AlertDialog.Builder(this)

更多推荐

如何展示活动组中的警报?

本文发布于:2023-11-27 03:57:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1636484.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:警报   组中

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!