开发者

Quick question about storage on android

This is my first question relating to android development. I would like to know the best way to go about storing an array on an android phone so that even when the app/activity is ended the data remains, I thought about doing it using a SQLite db, but have not been able to find any information ab开发者_开发问答out how to keep this database even when the app has ended.

Any advice would be apprectiated, thanks.

Sam


There are several methods to use in Android to storage data.

  • Store data in internal memory (files in internal memory).
  • Store data in external memory (files in the sdcard).
  • Store data as preferences (SharedPreferences).
  • Store data in a SQLLite database.

In my case, I use one method or another depending on the type of data. I only use SharedPreferences for application settings although that is only my rule. To save information in a SQLLite database you only have to insert records, like using any other database. This records will keep saved after your application finish.

You can find more information here: http://developer.android.com/guide/topics/data/data-storage.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜