简体   繁体   中英

Access files on internal and external storage

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() .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM