and during the service is working.. it just fires out some updates to who ever is listening... i've done this... i've completed that....
and according to that, the ui can change further on, in what ever way it wants Am Dienstag, 4. September 2012 19:19:38 UTC+2 schrieb roemer: > > maybe i explained it bad, both of you are right.... > > of course the service knows in which state it is... the service is running > and does some stuff... but due to separation of concern.. the service > doesn't even know if there is a ui... or if there are more uis... or what > ever the ui is... and of course the ui doesn't maintain the state, because > the ui maybe doesn't even know all states the service is in... but how > would the user know what state the service is in... > > so thats the problem.. as you say, of course the ui shouldn't maintain the > state... and neither does it know the state.. it just displays some updates > and changes the ui in some certain way... > > lets say, i pass the service a workload by pressing a button, and > depending on the button, i change the background color... > but actually, the service doesn't care about this, the color feedback is > just for the user... once started, the service does his job > > Am Dienstag, 4. September 2012 19:10:42 UTC+2 schrieb TreKing: >> >> On Tue, Sep 4, 2012 at 11:55 AM, Justin Anderson <[email protected]>wrote: >> >>> there are callbacks to the ui, and recreating the ui while the service >>>> is running would mean that i have to maintain a lot of status information >>>> in the service, which is actually not the concern of the service at all... >>>> it just does its work, and fires some events... which of course don't >>>> affect the ui if the activity is finished.... >>>> >>> >>> I completely disagree here... In a good OO design the different states >>> of the service should be maintained by the service, not by the Activity. >>> Maintaining the state of the service anywhere else (like the UI) would lead >>> to the service and the UI getting out of sync with one another... As an >>> example, the service could be finished but the UI would be out of date and >>> say that it is still running. >> >> >> I agree with Justin here. In fact, I'd take it a step further - the logic >> and state of whatever the Service is doing would be a completely separate >> business object that does the real work and maintains the state or status >> of that work. The Service is an Android-specific concept that you employ to >> make this object "go". The Activity is an Android-specific concept that you >> use to display the status of this business logic to the user. >> >> So this object should be doing the bulk of the work and the Service and >> Activity should merely be interfacing with it as necessary to accomplish >> their own purposes. >> >> >> ------------------------------------------------------------------------------------------------- >> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago >> transit tracking app for Android-powered devices >> >> -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

