android-save map< string,object[]>到文件

mm5n2pyu  于 2021-08-25  发布在  Java
关注(0)|答案(0)|浏览(153)

如何将此类Map保存到文件(它应该也适用于android设备)
我试过:

Properties properties = new Properties();

        for (Map.Entry<String, Object[]> entry : map.entrySet()) {
            properties.put(entry.getKey(), entry.getValue());
        }

        try {
            properties.store(new FileOutputStream(context.getFilesDir() + MainActivity.FileName), null);
        } catch (IOException e) {
            e.printStackTrace();
        }

我得到:

class java.util.ArrayList cannot be cast to class java.lang.String (java.util.ArrayList and java.lang.String are in module java.base of loader 'bootstrap')

我该怎么办?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题