Download windowmanager in fragment12/9/2023 In a mid-large size project, it's very easy for things like this to slip through the cracks. It's a thing, and while I've never personally used it, I've faced many places where the side-effects of that are everywhere. ![]() ![]() enabled that in the past (maybe still do) because it's a "cheap way to get the state saved". This may or may not surprise you, but a lot of apps, companies, devs, etc. It is not triggered if a fragment has `setRetainInstance(true). It is triggered, if you attach it to a correct lifecycle ( viewLifecycleOwner.lifecycle). Not all teams work the same way, so I understand the motivation behind something like this. I don't think this is "too error prone", but then again, I don't know your coding practices, style, and the environment you have to work on. We did too, but I found out they were using setRetainInstance(true) and this alters the lifecycle of a Fragment in Fragment Manager during these configuration changes this confuses DefaultLifecycleObserver's owner and the callback is not called.Įxactly, because we don't want this ugly and error-prone code repeated all over our fragments. ![]() □ I might have to look at it later, although I would expect the lifecycle to be symmetric. Interesting, I would expect that if Android kills the view, then onDestroyView should be called. viewBinding( viewBindingFactory : ( View) -> T) =įragmentViewBindingDelegate( this, viewBindingFactory) Import į( object : DefaultLifecycleObserver įun Fragment.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |