I am building an Android guitar application and I need a way for
GuitarString objects to notify multiple listeners that it has just been played. This includes the current
Activity and all instances of
GuitarStringView that have it as their
GuitarString (the guitar is displayed twice, zoomed in & out).
I have so far handled this by having a
GuitarString and each
Activity adds themselves to that list. My
Guitar class is a Singleton (which I know some may frown upon) so now I have to make sure objects remove themselves from the array of listeners when they're disposed of.
So my question is, is this a good approach, or is there a pattern that I should be using to handle this?