@Override
  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_view_address);

    Intent intent = getIntent();
    mAddress = intent.getExtras().getString("address");
    mAmount = intent.getExtras().getLong("amount");

    BigInteger amt = mAmount == 0 ? null : BigInteger.valueOf(mAmount);

    mURI = BitcoinURI.convertToBitcoinURI(mAddress, amt, null, null);

    mLogger.info("view address uri=" + mURI);

    final int size = (int) (240 * getResources().getDisplayMetrics().density);

    Bitmap bm = createBitmap(mURI, size);
    if (bm != null) {
      ImageView iv = (ImageView) findViewById(R.id.address_qr_view);
      iv.setImageBitmap(bm);
    }

    TextView idtv = (TextView) findViewById(R.id.address);
    idtv.setText(mAddress);

    updateAmount();

    mLogger.info("ViewAddressActivity created");
  }
  private String determineBitcoinRequestStr(final boolean includeBluetoothMac) {
    final ECKey key = (ECKey) addressView.getSelectedItem();
    final Address address = key.toAddress(Constants.NETWORK_PARAMETERS);
    final BigInteger amount = amountCalculatorLink.getAmount();

    final StringBuilder uri =
        new StringBuilder(BitcoinURI.convertToBitcoinURI(address, amount, null, null));
    if (includeBluetoothMac && bluetoothMac != null) {
      uri.append(amount == null ? '?' : '&');
      uri.append(Bluetooth.MAC_URI_PARAM).append('=').append(bluetoothMac);
    }
    return uri.toString();
  }
  @Override
  public boolean onContextItemSelected(final MenuItem item) {
    try {
      final AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo) item.getMenuInfo();

      final Map<String, Object> map =
          (Map<String, Object>) getListView().getAdapter().getItem(menuInfo.position);

      final String address = (String) map.get("addr");

      switch (item.getItemId()) {
        case R.id.wallet_addresses_context_archive:
          {
            MyRemoteWallet remoteWallet = application.getRemoteWallet();

            if (remoteWallet == null) return true;

            remoteWallet.setTag(address, 2);

            application.saveWallet(
                new SuccessCallback() {
                  @Override
                  public void onSuccess() {
                    EventListeners.invokeWalletDidChange();
                  }

                  @Override
                  public void onFail() {}
                });
            return true;
          }
        case R.id.wallet_addresses_context_edit:
          {
            EditAddressBookEntryFragment.edit(getFragmentManager(), address.toString());
            return true;
          }

        case R.id.wallet_addresses_context_show_qr:
          {
            final String uri = BitcoinURI.convertToBitcoinURI(address, null, null, null);
            final int size = (int) (256 * getResources().getDisplayMetrics().density);
            new QrDialog(activity, WalletUtils.getQRCodeBitmap(uri, size)).show();
            return true;
          }

        case R.id.wallet_addresses_context_copy_to_clipboard:
          {
            AbstractWalletActivity.handleCopyToClipboard(activity, address.toString());
            return true;
          }

        case R.id.wallet_addresses_context_default:
          {
            handleDefault(address);
            return true;
          }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    return false;
  }
  @Override
  public void loadForm() {
    // get the current address, label and amount from the model
    String address =
        this.bitcoinController.getModel().getActiveWalletPreference(BitcoinModel.SEND_ADDRESS);
    String label =
        this.bitcoinController.getModel().getActiveWalletPreference(BitcoinModel.SEND_LABEL);
    String amountNotLocalised =
        this.bitcoinController.getModel().getActiveWalletPreference(BitcoinModel.SEND_AMOUNT);

    if (amountBTCTextField != null) {
      CurrencyConverterResult converterResult =
          CurrencyConverter.INSTANCE.parseToBTCNotLocalised(amountNotLocalised);

      if (converterResult.isBtcMoneyValid()) {
        parsedAmountBTC = converterResult.getBtcMoney();
        String amountLocalised =
            CurrencyConverter.INSTANCE.getBTCAsLocalisedString(converterResult.getBtcMoney());
        amountBTCTextField.setText(amountLocalised);
        if (notificationLabel != null) {
          notificationLabel.setText("");
        }
      } else {
        parsedAmountBTC = null;
        amountBTCTextField.setText("");
        if (notificationLabel != null) {
          notificationLabel.setText(converterResult.getBtcMessage());
        }
      }
    }

    if (address != null) {
      addressTextField.setText(address);
    } else {
      addressTextField.setText("");
    }
    if (label != null) {
      labelTextArea.setText(label);
    } else {
      labelTextArea.setText("");
    }

    // if there is a pending 'handleopenURI' that needs pasting into the
    // send form, do it
    String performPasteNow =
        this.bitcoinController
            .getModel()
            .getActiveWalletPreference(BitcoinModel.SEND_PERFORM_PASTE_NOW);
    if (Boolean.TRUE.toString().equalsIgnoreCase(performPasteNow)) {
      try {
        Address decodeAddress =
            new Address(this.bitcoinController.getModel().getNetworkParameters(), address);
        processDecodedString(
            com.google.bitcoin.uri.BitcoinURI.convertToBitcoinURI(
                decodeAddress, Utils.toNanoCoins(amountNotLocalised), label, null),
            null);
        this.bitcoinController
            .getModel()
            .setActiveWalletPreference(BitcoinModel.SEND_PERFORM_PASTE_NOW, "false");
        sendButton.requestFocusInWindow();

        mainFrame.bringToFront();
      } catch (AddressFormatException e) {
        throw new RuntimeException(e);
      }
    }
  }