C# 从“活动”中删除所有视图
我使用方法AddContentView在活动中添加我的视图:C# 从“活动”中删除所有视图,c#,android,android-activity,view,xamarin.forms,C#,Android,Android Activity,View,Xamarin.forms,我使用方法AddContentView在活动中添加我的视图: protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); global::Xamarin.Forms.Forms.Init (this, bundle); LoadApplication (new App()); this.AddContentView (myView, layoutPararms); } pr
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
global::Xamarin.Forms.Forms.Init (this, bundle);
LoadApplication (new App());
this.AddContentView (myView, layoutPararms);
}
protected override void OnBackPressed ()
{
this.RemoveAllViews() //this method does not contain in Activity
}
我按下“后退”按钮并多次打开我的应用程序。
内存溢出,因为我每次在OnCreate方法中都在活动中添加视图。
如何从“活动”中删除所有视图?您在OnCreate中不使用AddContentView,因为LoadApplication已经使用了它。您在OnCreate中不使用AddContentView,因为LoadApplication已经使用了它。否,此项目包含AddContentView,我必须从“活动”中删除所有视图否,此项目包含AddContentView,我必须从“活动”中删除所有视图