我已经尝试了几十个教程,并关闭了stackoverflow和其他网站以尝试使其正常工作。有问题的应用程序有一个自定义类,它包含一个列表,其中包含列表中的项目。理想情况下,我希望能够在关闭或暂停时保存其他活动。我遇到的问题是,当我关闭另一个活动时(通过按下后退按钮),它会显示保存消息的日志。但是,当我打开它而不是加载它应该保存的信息时,它显示一个空白列表。这里是我的代码:Android Studio-将自定义类(使用ArrayList)保存到一个文件
这是自定义类的引用,保存和负载方法可以称为主要活动:
public class ReminderList extends AppCompatActivity {
public static ListHolder Lholder;
public static ArrayList AllReminders=new ArrayList<>();
public reminderCAdapter adapter;
public static ReminderType currentReminderType;
public static ItemType currentItemType;
public static TimeType currentTimesType;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_reminder_list);
//generate list
File fil