在每个活动中访问自定义列表

时间:2014-05-08 07:46:19

标签: c# android android-intent android-activity xamarin

我正在使用C#在Xamarin中创建一个Android应用程序。我每次点击一个按钮时都会调用一个活动。内容会按原样更改,但每次重新加载活动时,我的自定义List都会再次为空。我希望它保留其值,以便我可以在第二个屏幕上访问它们。

这是我的清单:

public List<Screen> ListScreens;

这就是调用Activity的方式:

saveButton.Click += delegate {
    if(ValidateScreen()){
        SaveData();
        Intent intent = new Intent(this, typeof(MainActivity));
        intent.PutExtra("CurrentScreenId", CurrentScreenId + 1);
        StartActivity(intent);
    }
};

我是否必须在意图中传递List,或者在每项活动中是否有其他方式来访问它?

0 个答案:

没有答案