Example usage for android.app Dialog setContentView

List of usage examples for android.app Dialog setContentView

Introduction

In this page you can find the example usage for android.app Dialog setContentView.

Prototype

public void setContentView(@NonNull View view, @Nullable ViewGroup.LayoutParams params) 

Source Link

Document

Set the screen content to an explicit view.

Usage

From source file:ab.util.AbDialogUtil.java

/**
 * progressDialog/*  w  w w.j  ava  2  s.co m*/
 * 
 * @param context
 * @param msg
 * @return
 */
public static Dialog createLoadingDialog(Context context, String msg) {
    LayoutInflater inflater = LayoutInflater.from(context);
    View v = inflater.inflate(R.layout.herily_alertex_dialog_custom_frame_layout, null);// view
    ProgressWheel spaceshipImage = (ProgressWheel) v.findViewById(R.id.customFrameLoadImg);
    spaceshipImage.stopSpinning();
    spaceshipImage.startSpinning();
    TextView tipTextView = (TextView) v.findViewById(R.id.customFrameMsg);// ??
    tipTextView.setText(msg);// ?
    Dialog loadingDialog = new Dialog(context, R.style.loading_dialog);// ?dialog
    loadingDialog.setCancelable(false);// ????
    loadingDialog.setContentView(v, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
            LinearLayout.LayoutParams.FILL_PARENT));// 
    return loadingDialog;
}

From source file:dev.dworks.apps.anexplorer.DocumentsActivity.java

private void initProtection() {

    if (authenticated || !SettingsActivity.isPinEnabled(this)) {
        return;//from   www  . j ava  2s.com
    }
    final Dialog d = new Dialog(this, R.style.Theme_DailogPIN);
    d.setContentView(
            new PinViewHelper((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE), null, null) {
                public void onEnter(String password) {
                    super.onEnter(password);
                    if (SettingsActivity.checkPin(DocumentsActivity.this, password)) {
                        authenticated = true;
                        d.dismiss();
                    } else {
                        Toast.makeText(DocumentsActivity.this, getString(R.string.incorrect_pin),
                                Toast.LENGTH_SHORT).show();
                    }
                };

                public void onCancel() {
                    super.onCancel();
                    finish();
                    d.dismiss();
                };
            }.getView(), new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

    PINDialogFragment pinFragment = new PINDialogFragment();
    pinFragment.setDialog(d);
    pinFragment.setCancelable(false);
    pinFragment.show(getFragmentManager(), "PIN Dialog");
}