Search in sources :

Example 1 with AddressAndLabel

use of de.schildbach.wallet.ui.AddressAndLabel in project bitcoin-wallet by bitcoin-wallet.

the class SendCoinsFragment method validateReceivingAddress.

private void validateReceivingAddress() {
    try {
        final String addressStr = receivingAddressView.getText().toString().trim();
        if (!addressStr.isEmpty()) {
            final Address address = Address.fromString(Constants.NETWORK_PARAMETERS, addressStr);
            final String label = addressBookDao.resolveLabel(address.toString());
            viewModel.validatedAddress = new AddressAndLabel(Constants.NETWORK_PARAMETERS, address.toString(), label);
            receivingAddressView.setText(null);
            log.info("Locked to valid address: {}", viewModel.validatedAddress);
        }
    } catch (final AddressFormatException x) {
    // swallow
    }
}
Also used : AddressFormatException(org.bitcoinj.core.AddressFormatException) Address(org.bitcoinj.core.Address) AddressAndLabel(de.schildbach.wallet.ui.AddressAndLabel)

Aggregations

AddressAndLabel (de.schildbach.wallet.ui.AddressAndLabel)1 Address (org.bitcoinj.core.Address)1 AddressFormatException (org.bitcoinj.core.AddressFormatException)1