Example usage for android.app Dialog getWindow

List of usage examples for android.app Dialog getWindow

Introduction

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

Prototype

public @Nullable Window getWindow() 

Source Link

Document

Retrieve the current Window for the activity.

Usage

From source file:piuk.blockchain.android.ui.dialogs.TransactionSummaryDialog.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    super.onCreateDialog(savedInstanceState);

    final FragmentActivity activity = getActivity();

    final LayoutInflater inflater = LayoutInflater.from(activity);

    final Builder dialog = new AlertDialog.Builder(new ContextThemeWrapper(activity, R.style.Theme_Dialog))
            .setTitle(R.string.transaction_summary_title);

    final LinearLayout view = (LinearLayout) inflater.inflate(R.layout.transaction_summary_fragment, null);

    dialog.setView(view);/*from   www. j a v  a2 s. c  o  m*/

    try {
        final MyRemoteWallet wallet = application.getRemoteWallet();

        BigInteger totalOutputValue = BigInteger.ZERO;
        for (TransactionOutput output : tx.getOutputs()) {
            totalOutputValue = totalOutputValue.add(output.getValue());
        }

        final TextView resultDescriptionView = (TextView) view.findViewById(R.id.result_description);
        final TextView toView = (TextView) view.findViewById(R.id.transaction_to);
        final TextView toViewLabel = (TextView) view.findViewById(R.id.transaction_to_label);
        final View toViewContainer = (View) view.findViewById(R.id.transaction_to_container);
        final TextView hashView = (TextView) view.findViewById(R.id.transaction_hash);
        final TextView transactionTimeView = (TextView) view.findViewById(R.id.transaction_date);
        final TextView confirmationsView = (TextView) view.findViewById(R.id.transaction_confirmations);
        final TextView noteView = (TextView) view.findViewById(R.id.transaction_note);
        final Button addNoteButton = (Button) view.findViewById(R.id.add_note_button);
        final TextView feeView = (TextView) view.findViewById(R.id.transaction_fee);
        final View feeViewContainer = view.findViewById(R.id.transaction_fee_container);
        final TextView valueNowView = (TextView) view.findViewById(R.id.transaction_value);
        final View valueNowContainerView = view.findViewById(R.id.transaction_value_container);

        String to = null;
        for (TransactionOutput output : tx.getOutputs()) {
            try {
                String toAddress = output.getScriptPubKey().getToAddress().toString();
                if (!wallet.isAddressMine(toAddress)) {
                    to = toAddress;
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        String from = null;
        for (TransactionInput input : tx.getInputs()) {
            try {
                String fromAddress = input.getFromAddress().toString();
                if (!wallet.isAddressMine(fromAddress)) {
                    from = fromAddress;
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        long realResult = 0;
        int confirmations = 0;

        if (tx instanceof MyTransaction) {
            MyTransaction myTx = (MyTransaction) tx;

            realResult = myTx.getResult().longValue();

            if (wallet.getLatestBlock() != null) {
                confirmations = wallet.getLatestBlock().getHeight() - myTx.getHeight() + 1;
            }

        } else if (application.isInP2PFallbackMode()) {
            realResult = tx.getValue(application.bitcoinjWallet).longValue();

            if (tx.getConfidence().getConfidenceType() == ConfidenceType.BUILDING)
                confirmations = tx.getConfidence().getDepthInBlocks();
        }

        final long finalResult = realResult;

        if (realResult <= 0) {
            toViewLabel.setText(R.string.transaction_fragment_to);

            if (to == null) {
                ((LinearLayout) toViewContainer.getParent()).removeView(toViewContainer);
            } else {
                toView.setText(to);
            }
        } else {
            toViewLabel.setText(R.string.transaction_fragment_from);

            if (from == null) {
                ((LinearLayout) toViewContainer.getParent()).removeView(toViewContainer);
            } else {
                toView.setText(from);
            }
        }

        //confirmations view
        if (confirmations > 0) {
            confirmationsView.setText("" + confirmations);
        } else {
            confirmationsView.setText("Unconfirmed");
        }

        //Hash String view
        final String hashString = new String(Hex.encode(tx.getHash().getBytes()), "UTF-8");

        hashView.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                Intent browserIntent = new Intent(Intent.ACTION_VIEW,
                        Uri.parse("https:/" + Constants.BLOCKCHAIN_DOMAIN + "/tx/" + hashString));

                startActivity(browserIntent);
            }
        });

        //Notes View
        String note = wallet.getTxNotes().get(hashString);

        if (note == null) {
            addNoteButton.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    dismiss();

                    AddNoteDialog.showDialog(getFragmentManager(), hashString);
                }
            });

            view.removeView(noteView);
        } else {
            view.removeView(addNoteButton);

            noteView.setText(note);

            noteView.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    dismiss();

                    AddNoteDialog.showDialog(getFragmentManager(), hashString);
                }
            });
        }

        addNoteButton.setEnabled(!application.isInP2PFallbackMode());

        SpannableString content = new SpannableString(hashString);
        content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
        hashView.setText(content);

        if (realResult > 0 && from != null)
            resultDescriptionView.setText(this.getString(R.string.transaction_fragment_amount_you_received,
                    WalletUtils.formatValue(BigInteger.valueOf(realResult))));
        else if (realResult < 0 && to != null)
            resultDescriptionView.setText(this.getString(R.string.transaction_fragment_amount_you_sent,
                    WalletUtils.formatValue(BigInteger.valueOf(realResult))));
        else
            resultDescriptionView.setText(this.getString(R.string.transaction_fragment_amount_you_moved,
                    WalletUtils.formatValue(totalOutputValue)));

        final Date time = tx.getUpdateTime();

        transactionTimeView.setText(dateFormat.format(time));

        //These will be made visible again later once information is fetched from server
        feeViewContainer.setVisibility(View.GONE);
        valueNowContainerView.setVisibility(View.GONE);

        if (tx instanceof MyTransaction) {
            MyTransaction myTx = (MyTransaction) tx;

            final long txIndex = myTx.getTxIndex();

            final Handler handler = new Handler();

            new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        final JSONObject obj = getTransactionSummary(txIndex, wallet.getGUID(), finalResult);

                        handler.post(new Runnable() {
                            @Override
                            public void run() {
                                try {
                                    if (obj.get("fee") != null) {
                                        feeViewContainer.setVisibility(View.VISIBLE);

                                        feeView.setText(WalletUtils.formatValue(
                                                BigInteger.valueOf(Long.valueOf(obj.get("fee").toString())))
                                                + " BTC");
                                    }

                                    if (obj.get("confirmations") != null) {
                                        int confirmations = ((Number) obj.get("confirmations")).intValue();

                                        confirmationsView.setText("" + confirmations);
                                    }

                                    String result_local = (String) obj.get("result_local");
                                    String result_local_historical = (String) obj
                                            .get("result_local_historical");

                                    if (result_local != null && result_local.length() > 0) {
                                        valueNowContainerView.setVisibility(View.VISIBLE);

                                        if (result_local_historical == null
                                                || result_local_historical.length() == 0
                                                || result_local_historical.equals(result_local)) {
                                            valueNowView.setText(result_local);
                                        } else {
                                            valueNowView.setText(getString(R.string.value_now_ten, result_local,
                                                    result_local_historical));
                                        }
                                    }
                                } catch (Exception e) {
                                    e.printStackTrace();
                                }
                            }
                        });
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }).start();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    Dialog d = dialog.create();

    WindowManager.LayoutParams lp = new WindowManager.LayoutParams();

    lp.dimAmount = 0;
    lp.width = WindowManager.LayoutParams.FILL_PARENT;
    lp.height = WindowManager.LayoutParams.WRAP_CONTENT;

    d.show();

    d.getWindow().setAttributes(lp);

    d.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

    return d;
}

From source file:de.markusressel.android.tutorialtooltip.DialogFragmentTest.java

@NonNull
@Override/*from w w  w. j  a  v  a2 s  . co  m*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // ask to really close
    final Dialog dialog = new Dialog(getActivity()) {
        @Override
        public boolean onTouchEvent(MotionEvent event) {
            switch (event.getAction()) {
            // When user touches the screen
            case MotionEvent.ACTION_DOWN:
                // Getting X coordinate
                float x = event.getX();
                // Getting Y Coordinate
                float y = event.getY();

                createTutorialTooltip(x, y);
                return true;
            }

            return super.onTouchEvent(event);
        }
    };
    dialog.setTitle("Dialog Test");
    dialog.setCanceledOnTouchOutside(true);
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN
            | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

    //        WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
    //        lp.copyFrom(dialog.getWindow().getAttributes());
    ////        lp.width = WindowManager.LayoutParams.MATCH_PARENT;
    ////        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
    //        dialog.show();
    //        dialog.getWindow().setAttributes(lp);

    dialog.show();

    return dialog;
}

From source file:org.catrobat.catroid.ui.dialogs.OverwriteRenameMediaDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    View dialogView = LayoutInflater.from(context).inflate(R.layout.dialog_overwrite_media, null);

    replaceButton = (RadioButton) dialogView.findViewById(R.id.dialog_overwrite_media_radio_replace);
    replaceButton.setOnClickListener(this);
    renameButton = (RadioButton) dialogView.findViewById(R.id.dialog_overwrite_media_radio_rename);
    renameButton.setOnClickListener(this);
    mediaText = (EditText) dialogView.findViewById(R.id.dialog_overwrite_media_edit);
    mediaText.setText(mediaName);//  ww w. j  av  a  2  s.  c o  m
    mediaTextView = (TextView) dialogView.findViewById(R.id.dialog_overwrite_media_edit_text);
    mediaTextLine = dialogView.findViewById(R.id.dialog_overwrite_media_edit_line);

    final int header;
    final int replaceText;
    final int renameText;
    final int renameHeaderText;
    switch (mediaType) {
    case Constants.MEDIA_TYPE_LOOK:
        header = R.string.look_rename_overwrite;
        replaceText = R.string.overwrite_replace_look;
        renameText = R.string.overwrite_rename_look;
        renameHeaderText = R.string.new_look_name;
        break;
    case Constants.MEDIA_TYPE_SOUND:
        header = R.string.rename_sound_overwrite;
        replaceText = R.string.overwrite_replace_sound;
        renameText = R.string.overwrite_rename_sound;
        renameHeaderText = R.string.new_sound_name;
        break;
    default:
        header = R.string.rename_sprite_dialog;
        replaceText = R.string.overwrite_replace_default;
        renameText = R.string.overwrite_rename_default;
        renameHeaderText = R.string.new_sound_name;
    }

    replaceButton.setText(replaceText);
    renameButton.setText(renameText);
    mediaTextView.setText(renameHeaderText);

    Dialog dialog = new AlertDialog.Builder(getActivity()).setView(dialogView).setTitle(header)
            .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                }
            }).setNegativeButton(R.string.cancel_button, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dismiss();
                }
            }).create();

    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

    dialog.setOnShowListener(new OnShowListener() {
        @Override
        public void onShow(final DialogInterface dialog) {
            Button positiveButton = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE);
            positiveButton.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View view) {
                    handleOkButton();
                }
            });
        }
    });

    dialog.setOnKeyListener(new OnKeyListener() {
        @Override
        public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
            if (event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) {
                boolean okButtonResult = handleOkButton();
                if (!okButtonResult) {
                    return false;
                } else {
                    dismiss();
                }
                return okButtonResult;
            } else if (keyCode == KeyEvent.KEYCODE_BACK) {
                dismiss();
                return true;
            }
            return false;
        }
    });

    return dialog;
}

From source file:com.app.blockydemo.ui.dialogs.NewVariableDialog.java

@Override
public Dialog onCreateDialog(Bundle bundle) {
    final View dialogView = LayoutInflater.from(getActivity())
            .inflate(R.layout.dialog_formula_editor_variable_name, null);

    final Dialog dialogNewVariable = new AlertDialog.Builder(getActivity()).setView(dialogView)
            .setTitle(R.string.formula_editor_variable_dialog_title)
            .setNegativeButton(R.string.cancel_button, new OnClickListener() {
                @Override//  w w w  .  j ava  2s . co m
                public void onClick(DialogInterface dialog, int which) {
                    dialog.cancel();
                }
            }).setPositiveButton(R.string.ok, new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    handleOkButton(dialogView);
                }
            }).create();

    dialogNewVariable.setCanceledOnTouchOutside(true);
    dialogNewVariable.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

    dialogNewVariable.setOnShowListener(new OnShowListener() {
        @Override
        public void onShow(DialogInterface dialog) {
            handleOnShow(dialogNewVariable);
        }
    });

    return dialogNewVariable;
}

From source file:org.glucosio.android.activity.MainActivity.java

public void showExportCsvDialog() {
    final Dialog exportDialog = new Dialog(MainActivity.this, R.style.GlucosioTheme);

    WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
    lp.copyFrom(exportDialog.getWindow().getAttributes());
    lp.width = WindowManager.LayoutParams.WRAP_CONTENT;
    lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
    exportDialog.setContentView(R.layout.dialog_export);
    exportDialog.getWindow().setAttributes(lp);
    exportDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    exportDialog.getWindow().setDimAmount(0.5f);
    exportDialog.show();/* w w  w  . java  2  s  .c om*/

    exportDialogDateFrom = (TextView) exportDialog.findViewById(R.id.activity_export_date_from);
    exportDialogDateTo = (TextView) exportDialog.findViewById(R.id.activity_export_date_to);
    exportRangeButton = (RadioButton) exportDialog.findViewById(R.id.activity_export_range);
    final RadioButton exportAllButton = (RadioButton) exportDialog.findViewById(R.id.activity_export_all);
    final TextView exportButton = (TextView) exportDialog.findViewById(R.id.dialog_export_add);
    final TextView cancelButton = (TextView) exportDialog.findViewById(R.id.dialog_export_cancel);

    exportRangeButton.setChecked(true);

    exportDialogDateFrom.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Calendar now = Calendar.getInstance();
            DatePickerDialog dpd = DatePickerDialog.newInstance(MainActivity.this, now.get(Calendar.YEAR),
                    now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH));
            dpd.show(getFragmentManager(), "fromDateDialog");
            dpd.setMaxDate(now);
        }
    });

    exportDialogDateTo.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Calendar now = Calendar.getInstance();
            DatePickerDialog dpd = DatePickerDialog.newInstance(MainActivity.this, now.get(Calendar.YEAR),
                    now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH));
            dpd.show(getFragmentManager(), "toDateDialog");
            dpd.setMaxDate(now);
        }
    });

    exportRangeButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            boolean isChecked = exportRangeButton.isChecked();
            exportDialogDateFrom.setEnabled(true);
            exportDialogDateTo.setEnabled(true);
            exportAllButton.setChecked(!isChecked);
        }
    });

    exportAllButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            boolean isChecked = exportAllButton.isChecked();
            exportDialogDateFrom.setEnabled(false);
            exportDialogDateTo.setEnabled(false);
            exportRangeButton.setChecked(!isChecked);
            exportButton.setEnabled(true);
        }
    });

    exportButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (validateExportDialog()) {
                exportPresenter.onExportClicked(exportAllButton.isChecked());
                exportDialog.dismiss();
            } else {
                showSnackBar(getResources().getString(R.string.dialog_error), Snackbar.LENGTH_LONG);
            }
        }
    });

    cancelButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            exportDialog.dismiss();
        }
    });

}

From source file:com.alivenet.dmv.driverapplication.fragment.MyAccount.java

public void showActionSheet() {

    LayoutInflater inflater = LayoutInflater.from(getActivity());
    final Dialog myDialog = new Dialog(getActivity(), android.R.style.Theme_Translucent_NoTitleBar);
    myDialog.setCanceledOnTouchOutside(true);
    myDialog.getWindow().setLayout(AbsoluteLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.MATCH_PARENT);
    myDialog.getWindow().setGravity(Gravity.BOTTOM);
    myDialog.getWindow().getAttributes().windowAnimations = R.anim.slide_up;
    WindowManager.LayoutParams lp = myDialog.getWindow().getAttributes();
    lp.dimAmount = 0.75f;//from   w w w .  j  a  v  a2  s  . c  om
    myDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    myDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    myDialog.getWindow();

    View dialoglayout = inflater.inflate(R.layout.dialog_profile_actionsheet, null);
    myDialog.setContentView(dialoglayout);
    TextView mTvTakeFromCamera = (TextView) myDialog.findViewById(R.id.tvTakeFromCamera);
    TextView mTvTakeFromLibrary = (TextView) myDialog.findViewById(R.id.tvTakeFromLibrary);

    long timestamp = System.currentTimeMillis();
    AppData.getSingletonObject().setmFileTemp(getActivity(), "" + timestamp);
    mTvTakeFromCamera.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            myDialog.dismiss();
            takePicture(getActivity());

        }

    });

    mTvTakeFromLibrary.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            myDialog.dismiss();
            openGallery(getActivity());
        }

    });

    TextView tvCancel = (TextView) myDialog.findViewById(R.id.tvCancel);

    tvCancel.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            myDialog.dismiss();
        }

    });

    try {
        myDialog.show();
    } catch (WindowManager.BadTokenException e) {

        Log.e("", "View not attached.");
    } catch (Exception e) {

        e.printStackTrace();
    }
}

From source file:nf.frex.android.FrexActivity.java

private Dialog createColorsDialog() {
    Dialog dialog = new Dialog(this);
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
    dialog.setContentView(R.layout.colors_dialog);
    dialog.setTitle(getString(R.string.colors));
    dialog.setCancelable(true);/*from w ww  .  ja v a2s.  c om*/
    dialog.setCanceledOnTouchOutside(true);
    return dialog;
}

From source file:com.emergencyskills.doe.aed.UI.activity.TabsActivity.java

public void showconfirmationdialog(final int fragnumber) {
    final Dialog dialog = new Dialog(TabsActivity.this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.dialog_leaving_confirmation);
    dialog.getWindow()
            .setBackgroundDrawable(new ColorDrawable(getResources().getColor(android.R.color.transparent)));

    Button yes = (Button) dialog.findViewById(R.id.yesbtn);
    yes.setOnClickListener(new View.OnClickListener() {
        @Override/* w  w w.j  a v  a  2 s .  c  o  m*/
        public void onClick(View v) {

            switch (fragnumber) {
            case 1:
                showpickupschool();
                break;
            case 2:
                showdrill();
                break;
            case 3:
                showservice();
                break;
            case 4:
                showinstall();
                break;
            case 5:
                showpending();
                break;

            }
            dialog.dismiss();

        }
    });
    Button no = (Button) dialog.findViewById(R.id.nobtn);
    no.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });
    ImageView close = (ImageView) dialog.findViewById(R.id.ivClose);
    close.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    dialog.show();
}

From source file:com.neighbor.ex.tong.ui.activity.MainActivity2Activity.java

private void showDialogAree() {
    final Dialog dialog = new Dialog(this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

    dialog.setContentView(R.layout.dialog_agree); // custom_dialog.xml  ? layout  ?? view .
    WindowManager.LayoutParams params = dialog.getWindow().getAttributes();
    params.width = LinearLayout.LayoutParams.MATCH_PARENT;
    final CheckBox accountLicense = (CheckBox) dialog.findViewById(R.id.checkBoxAgree);
    final Button agreeBtn = (Button) dialog.findViewById(R.id.buttonAgree);
    final Button agreeCancelBtn = (Button) dialog.findViewById(R.id.buttonAgreeCancel);
    agreeBtn.setOnClickListener(new View.OnClickListener() {
        @Override/*from  w  ww .j  a  v  a  2s .c om*/
        public void onClick(View view) {
            if (accountLicense.isChecked()) {
                SharedPreferenceManager.setValue(MainActivity2Activity.this,
                        SharedPreferenceManager.positionAgree, "true");
                dialog.dismiss();
            }
        }
    });
    agreeCancelBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            finish();
        }
    });
    dialog.setCancelable(false);
    dialog.setCanceledOnTouchOutside(false);
    dialog.show();
}

From source file:com.emergencyskills.doe.aed.UI.activity.TabsActivity.java

@Override
public void onBackPressed() {

    if (checkcurrentfragment())

    {/*from w w  w  .  j a  va  2 s  .  c o m*/
        final Dialog dialog = new Dialog(TabsActivity.this);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(R.layout.dialog_leaving_confirmation);
        dialog.getWindow()
                .setBackgroundDrawable(new ColorDrawable(getResources().getColor(android.R.color.transparent)));

        Button yes = (Button) dialog.findViewById(R.id.yesbtn);
        yes.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
                showpickupschool();

            }
        });
        Button no = (Button) dialog.findViewById(R.id.nobtn);
        no.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });
        ImageView close = (ImageView) dialog.findViewById(R.id.ivClose);
        close.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });

        dialog.show();
    } else {
        super.onBackPressed();
    }
}