Higher order function retain on rotation


I’m trying to see if it’s possible to remove some interfaces for callbacks when launching a fragment.

Basically I have an activity A where I define a callback function
Then from A I launch a fragment on which I then call fragment.setCallback() passing the function I defined in A

it all works but when I rotate my device the function is of course null and I was wondering how can I make it persist

thank you very much