Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find out when a fragment is permanently destroyed

Tags:

android

Is there a way to find out if a fragment is being permanently destroyed, i.e. that it won't be recreated in the future?

I need this to know when should I destroy a network task associated with the fragment.

like image 321
fhucho Avatar asked Nov 10 '22 21:11

fhucho


1 Answers

Something that should work is to call getActivity().isChangingConfigurations() in the fragment's onDestroy().

like image 75
fhucho Avatar answered Nov 14 '22 22:11

fhucho