When exactly is the Dispose methode of the main Activity called?

The MainActivity class inherits from Activity which inherits from IDisposable. However, it is not clear to me when the Dispose method is called. Each time I turn around my device, the constructor is called and the OnCreate method is called but not the Dispose method (I checked with break points). In the description of the activity life cycle:
http://developer.xamarin.com/guides/android/application_fundamentals/activity_lifecycle/

the Dispose method does not seem to be mentioned.

My main activity owns some members that implement IDisposable. According to the msdn:
https://msdn.microsoft.com/en-us/library/b1yfkh5e(v=vs.110).aspx

I should use the Dispose method to dispose these members. However, now it does not seem to be effective because when I make my own "protected override void Dispose(bool disposing)" it is not called. Maybe the "OnDestroy" method is the right place to dispose my disposable class members in my main activity?

Sign In or Register to comment.