Android Newly Taken Photo from custom camera does not appear in gallery (media store)

前端 未结 3 1146
时光取名叫无心
时光取名叫无心 2021-01-24 05:40
  1. in my app, i initially load all the images from the gallery, i.e. (MediaStore.Images.Media.EXTERNAL_CONTENT_URI)

  2. user can take picture via my app, but i

3条回答
  •  不知归路
    2021-01-24 05:59

    This works for now:

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
    
       sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://" + outPath)));
    
    }else{                      
    
       sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + outPath)));
    
    }
    

提交回复
热议问题