存储在SD卡的Andr​​oid应用程序数据 [英] storing android application data on SD Card

查看:169
本文介绍了存储在SD卡的Andr​​oid应用程序数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法来存储在SD卡上,而不是在内部存储器中的Andr​​oid应用程序的数据? 我知道如何应用SQLite数据库从内部存储器转移到SD卡,但如果内存已满摆在首位?如何每个人都处理?

Is there a way to store android application data on the SD card instead of in the internal memory? I know how to transfer the application sqlite database from the internal memory to the SDCard, but what if the internal memory gets full in the first place? How does everyone handle this?

推荐答案

警告:这个答案是过时。您应该使用<一个href="http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory()"相对=nofollow> Environment.getExternalStorageDirectory()以获得SD卡的根路径中提到以下的答案。

Warning: This answer is out-dated. You should use Environment.getExternalStorageDirectory() to get the root path of the SD card as mentioned in the answers below.

老答案,所以在这个有意义的评论:

Old Answer so the comments on this make sense:

添加 / SD卡/ 来你的路径应该将你的Andr​​oid应用程序中使用SD卡(至少它的工作原理是这样的G1)的根。 Android的文件系统对象,您可以检查文件的大小...所以它应该是可能的(如果技巧)写一些故障转移code的能力。这code会调整自己的根路径如果内存填满。

Adding /sdcard/ to the root your path should direct your Android application to use the SD card (at least it works that way with the G1). Android's file system objects give you the ability to check file sizes... so it should be possible (if tricky) to write some fail-over code. This code would adjust your root path if the internal memory filled up.

这篇关于存储在SD卡的Andr​​oid应用程序数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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