protected override void OnDestroy() { base.OnDestroy(); _cloudService.Disconnect(); _joystickInputDriver?.Dispose(); _joystickInputDriver = null; foreach (var pair in _paints) { pair.Value.Dispose(); } _paints.Clear(); _handler.RemoveCallbacks(_advanceAction); _handler.Dispose(); _handler = null; _handlerThread.Looper.Quit(); _handlerThread.Dispose(); _handlerThread = null; _advanceAction = null; _snakeView.Dispose(); _snakeView = null; _scoreView.Dispose(); _scoreView = null; }