Class NativeWalletChangeEventListener

java.lang.Object
org.bitcoinj.jni.NativeWalletChangeEventListener
All Implemented Interfaces:
WalletChangeEventListener

public class NativeWalletChangeEventListener extends Object implements WalletChangeEventListener
An event listener that relays events to a native C++ object. A pointer to that object is stored in this class using JNI on the native side, thus several instances of this can point to different actual native implementations.
  • Field Details

    • ptr

      public long ptr
  • Constructor Details

    • NativeWalletChangeEventListener

      public NativeWalletChangeEventListener()
  • Method Details

    • onWalletChanged

      public void onWalletChanged(Wallet wallet)
      Description copied from interface: WalletChangeEventListener

      Designed for GUI applications to refresh their transaction lists. This callback is invoked in the following situations:

      1. A new block is received (and thus building transactions got more confidence)
      2. A pending transaction is received
      3. A pending transaction changes confidence due to some non-new-block related event, such as being announced by more peers or by a double-spend conflict being observed.
      4. A re-organize occurs. Call occurs only if the re-org modified any of our transactions.
      5. A new spend is committed to the wallet.
      6. The wallet is reset and all transactions removed.

      When this is called you can refresh the UI contents from the wallet contents. It's more efficient to use this rather than onTransactionConfidenceChanged() + onReorganize() because you only get one callback per block rather than one per transaction per block. Note that this is not called when a key is added.

      Specified by:
      onWalletChanged in interface WalletChangeEventListener