Android - Why my saved image is not appearing in the default gallery of my phone?

前端 未结 5 995
时光说笑
时光说笑 2021-01-14 01:44

I am trying to save an image from my application to the default gallery of my phone. The code below works perfectly if I have a SD card on the phone. The image saved appears

5条回答
  •  长情又很酷
    2021-01-14 02:07

    Try this.

    Write down this line once image stored in gallery.

    File file = ..... // Save file
    
    context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(file)));
    

提交回复
热议问题