本文介绍了显示警告对话框中的所有画面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我开发时,它得到一个事件,这将显示一个Alertdialog中的应用程序。 目前,警报会仅在该特定的活动。 我需要得到这个警报的所有屏幕(如主屏幕,信息屏幕等),但我在打电话。
I am developing an application which will display an Alertdialog box when it gets an event. Currently the alert will come only in that particular activity. I need to get this alert on all the screens ( eg. home screen, message screen, etc )except I am in a call.
请提供解决方案这一点。
Please provide a solution for this.
推荐答案创建一些 utils的类的静态方法,将采用上下文作为参数,并建立整个对话。
Create some Utils class with static method that will takes Context as an argument and builds whole dialog.
编辑:
public class Utils { public static AlertDialog getDialog(Context context) { final AlertDialog.Builder builder = new AlertDialog.Builder(context); return builder .setTitle("title") .create() ; } }和调用它的每一个地方,你需要:
And call it in every place you need:
Utils.getDialog(context).show();更多推荐
显示警告对话框中的所有画面
发布评论