On 3/19/2012 9:01 PM, Dianne Hackborn wrote:
Personally I would say that for any question that implies you are subclassing Application, the answer is "no". :) Subclassing from Application doesn't let you do anything more than you could other ways, and there is a good chance it is going to lead you into a worse app design that you will ultimately be fighting with.
I just ran across roboguice. At first glance it seems like it requires that Application be subclassed so it can do its injection thing. Would you concede that use as an exception to your rule of thumb? While I haven't experimented with it yet (still climbing learning curves) I'm curious about what other developers think of it.
For something like navigation, the correct way to do this is to use a Service, and call Service.startForeground() when you are actively doing work the user cares about (navigating). This will also require that you post a notification, making the user aware of what you are doing (which by definition they already are, since the only reason to be foreground is because this is something the user directly cares about, so the notification gives them a facility to get back to it and manage it).
If one needed all the state but not really a service, isn't this what the Activity/ActivityFragment models? The state goes in the Activity and it is responsible for each ActivityFragment that it hosts and is in a position to ensure the proper state for the given fragment. I could well be out in left field here being fairly new to Android, but it seems to me that Notification is a little limited in what can be done as far as user interactions go?
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en