I am using the following code to set the full permission for a file in android.
But it is not working. I am not able to find the reason of that. Please help on this.
File mypath=new File(directory, filename+ ".png");
Runtime.getRuntime().exec("chmod 777 " + mypath);
System.out.println("FileExecute " + mypath.canExecute());
System.out.println("FileRead " + mypath.canRead());
System.out.println("FileWrite " + mypath.canWrite());
System.out.println("FileExists " + mypath.exists());
System.out.println("FileisFile " + mypath.isFile());
I am getting every output as ‘false’. Is there any other method to set the full permission.
If
exists()output is false it means that file dosn’t exists so you should first create it by call tomypath.createNewFile()