contentResolver を使用してファイルを削除しようとしましたが、実際のファイルではなく、データベースからエントリのみを削除しました。したがって、最初にエントリを削除し、後でファイルを削除してみます。
int rows = context.getContentResolver().delete(
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
MediaStore.Audio.Media._ID + "=" + idSong, null);
// Remove file from card
if (rows != 0) {
Uri uri = ContentUris.withAppendedId(
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, idSong);
File f = new File(uri.getPath());
if(!f.delete())
Log.d("fail-2", "fail-2");
}
else
Log.d("fail-1", "fail-1");
...そして出力は「fail-2」です。なんで?
ContentResolver が実際のファイルを削除しないのはなぜですか? これは正常ですか?