如何展示活动组中的警报? [英] how to show alert inside an activity group?

查看:73
本文介绍了如何展示活动组中的警报?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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)

这篇关于如何展示活动组中的警报?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆