Custom Listener

Define interface

//In this interface, you can define messages, which will be send to owner.
public interface MyCustomListener {
//In this case we have two messages,
//the first that is sent when the process is successful.
void onSuccess(List<Bitmap> bitmapList);
//And The second message, when the process will fail.
void onFailure(String error);
}

Create listener

In the next step we need to define an instance variable in the object that will send callback via MyCustomListener. And add setter for our listener.