This week's book giveaway is in the Security forum.
We're giving away four copies of Securing DevOps and have Julien Vehent on-line!
See this thread for details.
Win a copy of Securing DevOps this week in the Security forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Any downsides to implementing the Observer-Pattern inside a service?  RSS feed

Ranch Hand
Posts: 228
Android IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my app I want to "observe" an object if a button is pressed.

What I've done is create two buttons, "start" and "stop", these hook into the starting/stopping of a Service.

Inside that service, would it be a good place to implement an observer? ie when the service is started it will start observing another object, when it stops it will stop observing.

Is this a good design? Also, I can't find any specific examples/posts related to integrating the observer pattern and the service class, I can find separate tutorials but nothing combined.

Ankit, you're normally good for advice, any thoughts?
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!