2
I’m trying to delete a photo gallery via code by android studio. After the execution of the code the photo file still remains there without the image containing an exclamation as image. The name, size and details still continue, see the code::
File imagem = new File(v_CaminhoFoto + "/" + v_nome_foto);
imagem.delete();
It seems to me that he is only cleaning the photo bitmap and preserving the file.
Android manifest this already:
uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
This happens because the Gallery is only updated, by the Android OS, from time to time. See if this reply solves the problem.
– ramaral
See also if this answer solves the problem.
– viana
Really, thanks for your help. This simple code updates the gallery: // updates gallery to this deleted file sendBroadcast(New Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(new File(v_CaminhoFoto + "/" + v_foto))));
– Marcelo França