内部和外部存储访问文件 [英] Access files on internal and external storage

查看:272
本文介绍了内部和外部存储访问文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个新的Xperia信息v没有任何内部存储 - 只是一个SD卡作为外部存储,而银河S3既有内部和外部存储

在使用此功能 Environment.getExternalStorageDirectory(); 我可以访问文件只能在内部存储(S3),但与新的Xperia V无问题。

我如何可以访问内部和外部存储器中的文件?


解决方案

  

我有一个新的Xperia信息v没有任何内部存储


所有的Andr​​oid设备有内部存储,其中包括了Xperia新五内部存储空间,其中操作系统和应用程序数据存储 - 没有它,你的手机是行不通的。

presumably,您有话问题外部和可移动。在Android的术语外部是指可以由用户访问的独立地被堵塞在设备和主计算机之间的USB电缆。所有的Andr​​oid设备具有外部存储;无论是存储可移动或不发生变化。

那么,在新的Xperia第五的情况下,你拥有内部和外部存储和外部存储是重新通过可移动SD卡psented $ P $。


  

在使用此功能Environment.getExternalStorageDirectory();我只能访问内部存储(S3)文件,但没有与新的Xperia V无问题。


这是因为 getExternalStorageDirectory()返回的外部的该设备的存储目录。


  

我如何可以访问内部和外部存储器中的文件?


使用 getExternalStorageDirectory()以访问外部存储。使用 getFilesDir()来得到在内部存储应用的部分。

对于有外部存储多种形式的设备 - 比如你的Galaxy S3 - Android的SDK只支持任何其中之一是由 getExternalStorageDirectory提供访问()

I have an Xperia Neo V that does not have any internal storage - only an SD card as external storage, while the Galaxy S3 has both internal and external storage.

When using this function Environment.getExternalStorageDirectory(); I can access files only on internal storage(S3) but there is no problem with Xperia Neo V.

How can I access files on both internal and external storage?

解决方案

I have an Xperia Neo V that does not have any internal storage

All Android devices have internal storage, including the Xperia Neo V. Internal storage is where the OS and application data is stored -- without it, your phone would not work.

Presumably, you are having problems with the words "external" and "removable". In Android terms, "external" means "can be accessed by the user independently by plugging a USB cable between the device and a host computer". All Android devices have external storage; whether that storage is removable or not varies.

So, in the case of an Xperia Neo V, you have both internal and external storage, and the external storage is represented by a removable SD card.

When using this function Environment.getExternalStorageDirectory(); I can access files only on internal storage(S3) but there is no problem with Xperia Neo V.

That is because getExternalStorageDirectory() returns the external storage directory for that device.

How can I access files on both internal and external storage?

Use getExternalStorageDirectory() to get access to external storage. Use getFilesDir() to get at your app's portion of internal storage.

For devices that have multiple forms of external storage -- such as your Galaxy S3 -- the Android SDK only supports accessing whichever one of those is provided by getExternalStorageDirectory().

这篇关于内部和外部存储访问文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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