Android和数据存储空间? [英] Android and data storage space?

查看:120
本文介绍了Android和数据存储空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道有多少数据存储可用于我的Andr​​oid应用程序?

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

我需要缓存大量的文件,我想存储它的共享preferences里面,这样一来,如果应用程序被卸载它就会被删除。毕竟它只是缓存文件很多。我想我也可以使用SD卡,但比我没有什么用户做应用程序...

I need to cache lots of files, and i was thinking to store it inside the sharedpreferences, this way it gets deleted if the application is uninstalled. Afterall its just alot of cache files. I guess i could also use the SDCard, but than i dont have any controll of what the user does outside the application...

那么,有多少MB可以从共享preferences存储文件时,我的应用程序钢?

So, how many MB can my application steel from SharedPreferences when storing files ?

推荐答案

如果你计划的数据存储的MB,然后尝试使用SD卡,以避免填满建成尤其是在G1的手机往往是有限的存储空间。

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.

请参阅<一href="http://d.android.com/reference/android/content/Context.html#getDir%28java.lang.String,%20int%29"相对=nofollow> http://d.android.com/reference/android/content/Context.html#getDir(java.lang.String中,INT)

有关缓存的文件,您可以使用     文件cacheDir = getCacheDir(); 返回的路径,在文件系统中的特殊应用缓存目录。这些文件将是那些获得了第一个删除的设备在运行时存储时。

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.

请参阅 http://d.android.com /reference/android/content/Context.html#getCacheDir()以获取更多信息。

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

这篇关于Android和数据存储空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆