Well, suppose you want parts of your program to be notified when your bootloader starts scanning, and when it finishes scanning (don't worry about what Loader is, or about what scanning, these examples are from some code that I lay from my last job). You define an interface, call it "ScanListener", for example
public interface ScanListener
{
public void scanStarted();
public void scanCompleted();
}
Loader now defines a method for your other registration code for callbacks, for example
public void addScanListener(ScanListener listener)
{
listeners.add(listener);
}
The bootloader, when it launches a scan, executes the following code
for (ScanListener listener : listeners)
{
listener.scanStarted();
}
and when it ends, it does the same with listener.scanCompleted ();
, , ( , ), "loader.addScanListener(this)". scanStarted() scanCompleted() . , / . .