Code example for Dialog

Methods: getWindow, setContentView

0
     * <p>Initialize using layout 
     * @param layout 
     */ 
    private void initSetCustomDialog( LinearLayout layout) {
        mDialog = new Dialog(mContext,
                android.R.style.Theme_Translucent_NoTitleBar);
 
        // Setting dialog view 
        Window window = mDialog.getWindow();
        window.setGravity(Gravity.CENTER);
        window.setLayout(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
 
        mDialog.setContentView(layout);
    } 
     
    /** 
     * <p>Initialize</p> 
     */ 
    private void initCustomDialog() { 
        mDialog = new Dialog(mContext,
                android.R.style.Theme_Translucent_NoTitleBar);