Closed DmitriyZaitsev closed 9 years ago
Isn't it breaking service-to-context-binding and sometimes (I'm looking at Dagger) those service hierarchy?
ApplicationContext -> RootComponent as 'DaggerService'
ActivityContext -> ActivityComponent extends RootComponent as 'DaggerService'
ViewContext -> ViewComponent extends ActivityComponent as 'DaggerService'
Really, it breaks. Sorry, I was wrong. Need to close this pull request.
Hi! I suggest to use application context in
MortarScope.getScope()
. In our activities we callMortarScope.findChild(context)
andMortarScope.buildChild(context)
. Every time we must pass thegetApplicationContext()
as a parameter. I found that if developer forgets about it and accidentally passesthis
(currentActivity
instance), he'll get theStackOverflowException
because of recursive function call. To avoid this I propose my solution that ensures we'll always have correct context for getting system service by name.