Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.lang.reflect.Field;

import android.content.DialogInterface;

public class Main {
    /**set dialog dismiss or not*/
    public static void setDialogDismiss(DialogInterface dialog, boolean dismiss) {
        try {
            Field field = dialog.getClass().getSuperclass().getDeclaredField("mShowing");
            field.setAccessible(true);
            field.set(dialog, dismiss);
            dialog.dismiss();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}