How can i Use External Storage in android

六月ゝ 毕业季﹏ 提交于 2019-12-29 09:14:28

问题


This is for the first time i am using external storage in android. I need some help how can i perform different operations such as how to check whether External Storage is available or not?, How to write files or pictures into storage .


回答1:


how to check whether External Storage is available or not?

Use Environment.getExternalStorageState().

How to write files or pictures into storage

Use standard Java I/O, working off a directory built using Environment.getExternalStorageDirectory().




回答2:


To clarify the first part of CommonsWare's answer (I couldn't seem to add a comment to the comment stream): you want to check that...

Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);

... is true.



来源:https://stackoverflow.com/questions/3598445/how-can-i-use-external-storage-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!