What's the recommended way of accessing app's resources in a situation where the fragment may or may not be attached to the activity?
The reason I'm asking it's causing crashes when the asynchronous bit of code is getting executed while, for a reason like sending app to background, the fragment is no longer attached.
I could check if the fragment isAdded() and cancel the whole thing if it's not. But I'm thinking - can I just use app context reference kept in my Application? This should still be valid, correct?
Is accessing resources MyApplication.getContext().getResources() recommended approach or it has downsides?
Thanks