Deleted image still shows in android gallery untill I restart the emaulator

前端 未结 3 1529
别跟我提以往
别跟我提以往 2021-01-13 14:06

I\'m deleting a file as such

File fileToDelete =  new File(\"filepath\");
Boolean fileDeleted =  fileToDelete.delete();

The fileDeleted is

3条回答
  •  情话喂你
    2021-01-13 14:44

    It is to do with how Gallery shows the Image files. Image file's Thumbnails are cached in the MediaStore and all the details are present in the Mediastore contentProvider.

    Deleting the file will not update this database. But when you restart the emulator, Mediascanning is done by android. If MediaScanning can be triggered , gallery will stop showing the files

提交回复
热议问题