Android and data storage space?

前端 未结 2 350
情深已故
情深已故 2021-01-21 20:29

Im wondering how much data storage is available for my application in android?

I need to cache lots of files, and i was thinking to store it inside the sharedpreferences

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-21 21:09

    If you are planning to store MBs of data then try to use the sdcard to avoid filling the often limited storage built into the phone especially on the G1.

    If you do store data on the phone, each app has its own storage area which will also be deleted when the application is uninstalled.

    See http://d.android.com/reference/android/content/Context.html#getDir(java.lang.String, int)

    For cached files you can use File cacheDir = getCacheDir(); which returns the path to the application specific cache directory on the filesystem. These files will be ones that get deleted first when the device runs low on storage.

    See http://d.android.com/reference/android/content/Context.html#getCacheDir() for more information

提交回复
热议问题