I know that it is possible to change the permission mode of the file to be used:
This example sets the permission bit to The use of chmod in Android For java platform dependent tasks such as chmod Although the original support is not supported, Android. Android provides access to some of these operations through Android. The FileUtils class is not part of the public SDK and is therefore not supported. Therefore, use it at your own risk: context: Runtime .getRuntime (). Exec ("chmod 777 myfile"); .
777 . Is it possible to set permission code on
777 using Java? Can this be done in every file?
Public int chmod (file path, int mode) throws exception {class fileUtils = Class.forName ("android.os.FileUtils"); Method setpressions = fileUtils.getMethod ("setPermissions", String.class, int.class, int.class, int.class); Return (integer) setPermissions.invoke (empty, path. GateAbsolit path (), mode, -1, -1); } ... chmod ("/ foo / bar / hawk", 0755); ...
Comments
Post a Comment