How can I notify the gallery of a new image in android?

前端 未结 2 1126
轻奢々
轻奢々 2021-01-16 15:34

I have an android app that allows you to open an image on your phone using an intent to the Gallery. You make modifications to that image and the app saves it with a new na

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-16 15:45

    use the MediaScannerConnection -

    MediaScannerConnection.scanFile(context,
        new String[] { imagePath }, null,
        new MediaScannerConnection.OnScanCompletedListener() {                      
            @Override
            public void onScanCompleted(String path, Uri uri) {
                //....                              
            }
        });
    

提交回复
热议问题