Please take a look at my code bellow. Basically, I was able to erase the information contained in my file, but the empty file still exists on my android device. Instead of completely erasing my file, it only removes the information contained in the file.
public void removeCache(Uri uri){
File delete= new File(uri.getPath());
if(delete.exists()){
if(delete.delete()){
Log.d("Deleted", ""+uri);
}
boolean exists= delete.exists();
Log.d("Deleted", "does it exist? " + exists);
}
}
Log Message: D/Deleted: /storage/emulated/0/secretVideos/NHLPROMO.mp4 D/Deleted: does it exist? false
UPDATE: So basically, the file does not exist in its direct directory, but download folder in the Android default file viewer stills shows deleted files. This is really annoying and should be removed by google. As of now I do not see any solution to this problem.