Example usage for android.view Window setType

List of usage examples for android.view Window setType

Introduction

In this page you can find the example usage for android.view Window setType.

Prototype

public void setType(int type) 

Source Link

Document

Set the type of the window, as per the WindowManager.LayoutParams types.

Usage

From source file:com.mumu.joshautomation.HeadService.java

private void showExitConfirmDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(
            new ContextThemeWrapper(mContext, R.style.MyDialogStyle))
                    .setTitle(getString(R.string.headservice_stop_title))
                    .setMessage(getString(R.string.headservice_stop_info)).setPositiveButton(
                            getString(R.string.headservice_stop_button), new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    // Let's do some background stuff
                                    stopSelf();
                                }/*from  ww  w .j ava 2  s.com*/
                            })
                    .setNegativeButton(getString(R.string.startup_cancel),
                            new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                }
                            });
    AlertDialog alert = builder.create();
    Window win = alert.getWindow();
    if (win != null)
        win.setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
    alert.show();
}