我使用以下代码为android中的图像文件添加完整权限.此代码不是每次都有效.想象一下有三个图像文件,A.png,B.png和C.png.在某些情况下,所有文件都将获得完全权限.在某些情况下,A.png将获得并在某些条件下获得或A和B将获得完全许可.我找不到原因.请帮我找原因.
String iconFile = themePrefs.getString(info.activityInfo.name, ""); // Icon file = "/data/data/com.android.settings/MyApp/A.png";
System.out.println("FileExecute " + ico.canExecute()); //always false
System.out.println("FileRead " + ico.canRead()); //always false
System.out.println("FileWrite " + ico.canWrite()); //always false
System.out.println("FileExists " + ico.exists()); //always true
System.out.println("FileisFile " + ico.isFile()); //always true
System.out.println("FileisDirectory " + ico.isDirectory());//always false
Drawable d = null;
FileInputStream fis; // in stream
try {
File ico = new File(iconFile); //creating a file with the path (because only this is working with absolute path)
try {
Runtime.getRuntime().exec("chmod 777 …Run Code Online (Sandbox Code Playgroud)