开发者

How can I access & store data in the sdcard across all Android devices?

开发者 https://www.devze.com 2023-03-24 05:56 出处:网络
The Samsung GalaxyShas a folder named external_sd inside sdcard. I want to access this. I don\'t want to hard code the path Environment.get开发者_如何学PythonExternalStorageDirectory() + \"external_sd

The Samsung GalaxyS has a folder named external_sd inside sdcard. I want to access this. I don't want to hard code the path Environment.get开发者_如何学PythonExternalStorageDirectory() + "external_sd/".

I want the general path for all devices to store by default in sdcard. How can I do this?


You can access the externalstorage directory using this:

getExternalStoragePublicDirectory(String Type)

You can specify the file type and you get the location where you can store the file. This is the same space also used by the mobile user.

An alternative is to use the storage space for your own application. For that use,

getExternalFilesDir(String Type)

This space is application specific and will be deleted when the app is uninstalled. The user will not be able to see this files.

0

精彩评论

暂无评论...
验证码 换一张
取 消