0

I'm having this issue with my fragment only in API 31. In the host Activity I use replace to add my fragment:

transaction.replace(container, fragment, tag);

Everything runs as expected. But when I send the app in background in API 31 the fragment's lifecycle doesn't evolve as I was thinking. It doesn't call onDestroy. It only goes till onStop. Meanwhile, in previous versions of Android the fragment gets completely destroyed when I send the app to background.

Anyone else experiencing this problem?

  • As per official document they are suggesting to use Navigation Component instead of fragment transactions. Try Implementing that. – Siddarth Jain Jan 28 '22 at 10:35
  • @SiddarthJain We are having this app developed since 2015 in our corporate. Migrating to NavComponents is not going to happen any soon. – User88909000 Jan 28 '22 at 10:50
  • @SiddarthJain - whats "recommended" has got nothing to do with possible behavioural changes in API31? Also navigation component will ultimately just be abstractions over fragment transactions .. – Mark Jan 28 '22 at 11:00

0 Answers0