步骤:
1、建立application 获取context
2、在新建的对话框中设置全局显示
3、在AndroidManifest中获取权限
4、在想要显示的布局中建立对象调用
建立application 获取context
/*
*
*@auther Jianjun Huang
*
*@date 2015年12月11日
*/
public class MyApplication extends Application{
private static Context context;
private static Window window;
@Override
public void onCreate() {
context=getApplicationContext();
}
}
2-全局显示对话框的代码:
// 对话提醒
private void alterDiog(String cleanMember2, String weeks, String mWay) {
Duty_Dialog.Builder builder = new Duty_Dialog.Builder(MyApplication.getContext());
builder.setTitle("值日提醒");
// 设置信息
builder.setMessage("今天是" + "\t" + weeks + "\t" + mWay + "\n" + "值日人员:" + cleanMem