Is it possible to create and maintain a folder structure with files Using the Internal Storage

守給你的承諾、 提交于 2019-12-06 12:00:26

Is it possible to create and maintain a folder structure with files Using the Internal Storage

Yes, using standard Java I/O.

Or maybe tell me why the example below fails miserably

Talented programmers know how to describe symptoms, rather than use pointless phrases like "fails miserably".

That being said, file.mkdirs(); creates a directory. You then try opening that directory as if it were a file, for the purposes of writing data to it. That does not work on any OS that I am aware of, and certainly not on Android. Please call mkdirs() on something that will create the file's parent directory (e.g., file.getParentFile().mkdirs()).

Also, never use concatenation to create a File object. Use the proper File constructor.

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