public AddDialog(final Activity activity) {
      super(activity);
      this.setContentView(R.layout.add_to_address_book_dialog);
      this.setTitle(R.string.add_to_address_book_dialog_title);

      findViewById(R.id.btScan)
          .setOnClickListener(
              new android.view.View.OnClickListener() {

                @Override
                public void onClick(View v) {
                  Utils.startScannerIntent(activity, SCANNER_RESULT_CODE);
                  AddDialog.this.dismiss();
                }
              });

      Address address = Utils.addressFromString(Utils.getClipboardString(AddressBookActivity.this));
      findViewById(R.id.btClipboard).setEnabled(address != null);
      findViewById(R.id.btClipboard)
          .setOnClickListener(
              new android.view.View.OnClickListener() {

                @Override
                public void onClick(View v) {
                  String addressString = Utils.getClipboardString(AddressBookActivity.this);
                  addFromString(addressString);
                  AddDialog.this.dismiss();
                }
              });
    }
 private void addFromString(String addressString) {
   Address address = Utils.addressFromString(addressString);
   if (address == null) {
     return;
   }
   Utils.showSetAddressLabelDialog(
       AddressBookActivity.this, _addressBook, address.toString(), updateRunnable);
 }