Using the Android Application class to persist data

前端 未结 7 1120
栀梦
栀梦 2020-11-22 08:55

I\'m working on a fairly complex Android application that requires a somewhat large amount of data about the application (I\'d say a total of about 500KB -- is this large fo

7条回答
  •  星月不相逢
    2020-11-22 09:14

    I know this is the very old question but using the ViewModel from the jetpack components is the best way to preserve the data between Activity rotation.

    The ViewModel class is designed to store and manage UI-related data in a lifecycle conscious way. The ViewModel class allows data to survive configuration changes such as screen rotations.

提交回复
热议问题