How to store hashmap so that it can be retained it value after a device reboot?

前端 未结 3 1906
天涯浪人
天涯浪人 2020-11-30 13:06

I want to store the hashmap object in global class so that it will store value even after the mobile restart. Any idea how to go about this concept.

3条回答
  •  遥遥无期
    2020-11-30 13:52

    Serialize it and save it in shared preferences or in a file. Whether you can do this, of course, depends on the data types being mapped from and to. (This won't work, for instance, if you try to serialize a View.)

提交回复
热议问题