Unable to display and show AlertDialog in BroadcastReceiver in android
<pre><code>public class MySingleton {
    private static MySingleton instance;
    AlertDialog.Builder builder;
    boolean alertDisplayed;

    public static MySingleton getInstance() {
        if (instance == null) {
            instance = new MySingleton();
        }
        return instance;
    }

    private MySingleton() {

    }

    public void displayAlertDialog(final Activity context) {

        builder =
                new AlertDialog.Builder(context);
        final String action = Settings.ACTION_LOCATION_SOURCE_SETTINGS;
        final String message = "Enable either GPS or any other location"
                + " service to find current location.  Click OK to go to"
                + " location services settings to let you do so.";

        builder.setMessage(message).setCancelable(false)
                .setPositiveButton("OK",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface d, int id) {
                                context.startActivityForResult(new Intent(action), 1);
                                d.dismiss();
                            }
                        })
                .setNegativeButton("Retry",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface d, int id) {
                                context.finish();
                            }
                        });
        builder.create().show();
        alertDisplayed = true;

    }


    public void dismissDialog() {
        if (alertDisplayed &amp;&amp; builder != null) {
            //dismiss dialog
            dismissDialog();
        }
        alertDisplayed = false;
    }
}



 BroadcastReceiver updateBooleanBroadCastReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            // TODO Auto-generated method stub
            if (intent.getBooleanExtra("action", true)) {

              //here i want to hide Alert 
            } else {

              //Here i want to display Alert 

            }
        }
    };
</code></pre>

<p>i have Make class Singlton where i have write code to show and hide method of Alert box and also i have received  Event but i am unable to call Singsong class to show and hide Alert please help me how to get this .</p>