![]() ![]() Then this listener must be registered in all Downloads, so when a Download finishes it will call listener.onFinish(). This listener implements the notification functions onFinish(), onUpdate(), etc. The DownloadManager implements a "listener" (interface). Also, N observables 1 observer it's something weird, at least with the observer pattern because this pattern was done for 1 observable N observers, so I really won't be using the observer pattern. I can pass a param to the notify() method with the code of the notification.ĭisadvantage? I'm using an oop pattern for a thing that can be done easily with a callback. The advantage is to centralize all the possible notifications in one method, the notify() or update() (from java) method from the Observers, in my case only the DownloadManager. In my case the DownloadManager has te be an Observer and the Downloads the Observables, so the relation is N Observables 1 Observer, just the opposite. Somehow the DownloadManager has to receive this notifications from its Downloads.īasically there are 1 Observable and N Observers. I have to do a design of a DownloadManager, but my main question is related to the notifications that a Download can send to the DownloadManager like onUpdate() to update a progress bar, onError(), onFinish(), etc. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |