async void Delay() { await Task.Delay(800).ConfigureAwait(false); if (fragment != null) { fragment.Dispose(); } fragment = Camera2BasicFragment.NewInstance(); (this.Context as Activity).FragmentManager.BeginTransaction().Replace(Resource.Id.container, fragment).Commit(); if (Element.ExposureEnable) { AdjustExposure(Element.ExposureValue); } else { SetAutoExposure(); } if (Element.FocusEnable) { AdjustFocus(Element.FocusValue); } else { SetAutoFocus(); } }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (fragment != null) { //Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity.FragmentManager.BeginTransaction().Remove(fragment).Commit(); fragment.OnPause(); fragment = null; } }