Currently, I am using an interface to communicate from fragment to activity. I want to pass updated model back to the activity on onDestroyView to update UI but that is causing crash when activity is destroyed by system or we enable "don't keep activity" then move activity to background. This causes crash as we use this context to fetch images and get exception You cannot start a load for a destroyed activity
I know we can use shared viewModel with liveData but that would seem overkill if we have single activity and multiple fragments.
we can also use setFragmentResult
with supportFragmentManager.setFragmentResultListener
but using this result would be available to all fragments attached to through this fragmentManager
can we use some thing else to make communication lifecycle aware?