Android's Media Scanner: How do I remove files?

前端 未结 5 692
轮回少年
轮回少年 2020-12-08 17:42

I\'m writing an app that removes files that may or may not be listed in any one of the types of media libraries such as music or pictures. While I can use the MediaSca

5条回答
  •  孤城傲影
    2020-12-08 18:00

    The following works well for me. You can delete or add files using this.

    MediaScannerConnection.scanFile(
                    context,
                    new String[]{fileToDelete, fileToAdd},
                    null, null);
    

提交回复
热议问题