How to use java.nio.file package in android?

人盡茶涼 提交于 2019-11-29 10:36:28

The simple answer is that you can't do it. Android is Java 6 based, and (AFAIK) there is no backport of Java 7's java.nio.file classes to Android.

(That's not surprising. Porting java.nio.file would entail significant changes to the Davlik VM's native code libraries.)


Can you tell me that what API should I use for my requirements. ( My requirement is File operation like : Cut|copy|delete on files and directories);

I suggest you just use the java.io.File class for things like making directories, renaming files, and so on, and then implement the "higher level" operations such as copying files and directory trees using File.list() and FileInpuStream or FileOutputStream. You could possibly simplify some operations using classes such as the Apache commons DirectoryWalker FileUtils or Guava Files.

However, I'm not sure what you are trying to achieve here. There are already existing "file manager" apps for Android.

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