我想下面的代碼無法刪除的Android棒棒糖文件和更高
String Data = cursor.getString(cursor
.getColumnIndex(MediaStore.Audio.Media.DATA));
File file = new File(Data);
if (file != null && file.exists()) {
// delete it
Toast.makeText(FileEditorDialog.this, "deleted not null",
Toast.LENGTH_LONG).show();
}
boolean deleted = file.delete();
if (deleted) {
Toast.makeText(FileEditorDialog.this,
"Successfully Deleted", Toast.LENGTH_LONG).show();
sendBroadcast(new Intent(
Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,
Uri.parse("file://"
+ Environment.getExternalStorageDirectory())));
finish();
}
這個代碼在安卓果凍豆,但不是在Android的棒棒糖,我們如何能在Android的棒棒糖刪除文件
你有權限WRITE_EXTERNAL_STORAGE嗎? –
請提供給我們一個清單文件 –
錯誤是什麼? – Henry