mono/MonoGame — pull request #2769 by dellis1972 (2014-07-01 10:36:44+00:00)
Title: Android Context Lost Fix

Currently the code in the AndroidGameView assumes the GL Context is lost when the app is paused and resumed. So it always calls a DeviceReset and attempts to load the assets again. With the latest Xamarin.Android the bug that caused this issue is fixed. Two new methods have been introduced OnContextLost OnContextSet.

OnContextLost is only called if the GL context is actually broken, when this method is called the context is dead completely.

OnContextSet is only called when a context is created, this occurs on startup and only after the Context is actually lost. It is at this point what a valid context is available for loading textures and shaders. the normal Loaded method is called after this one.

These changes set the Resuming flag in the OnContextLost method so we can reload the assets on startup. This will happen very rarely since the original bug where the context was lost when a app was paused is fixed in the Xamarin.Android OpenTK 0.9.9.3 and 1.0.0.0. With this fix android apps should resume without the need to reload textures or shaders.