无法从Android中的手机存储中删除文件

时间:2017-03-13 18:11:39

标签: android eclipse file

我正在尝试删除位于路径

的文件
"/sdcard/Download/images.jpg"

到目前为止我做了什么:

try{
        File file = new File("/sdcard/Download/images.jpg");
        if(file.exists())
        { deleted = file.delete();
        Toast.makeText(getApplicationContext(), "File Deleted "+deleted,Toast.LENGTH_LONG ).show();
        }
        else
            Toast.makeText(getApplicationContext(), "File Not Deleted "+deleted,Toast.LENGTH_LONG ).show();
    }catch(Exception e){
        e.printStackTrace();


    }

现在我收到一个祝酒词:

  

文件已删除错误

并且文件仍在其位置(未删除:() 另外我在Manifest文件中给了android.permission.WRITE_EXTERNAL_STORAGE。

0 个答案:

没有答案