imagedirectory = new File(path);
imagepool = imagedirectory.listFiles();
Uri targetdelete = Uri.fromFile(imagepool[photoindex]); //photoindex is integer 1
File filetodelete = new File(targetdelete);
boolean deleted = filetodelete.delete();
刪除一個文件,我在這行我試圖寫一個方法來自於Android設備的內部存儲和
File filetodelete = new File(targetdelete);
收到一個錯誤,它說targetdelete必須是一個字符串對象.. ..我認爲在初始化一個File對象時把Uri對象作爲參數是有效的嗎?
再次感謝堆棧溢出的精彩專家!
http://meta.stackexchange.com/a/5235/169610接受答案..... – Uttam