sandalone
sandalone

Reputation: 41779

Refresh gallery on Android 7 downwards?

I can use MediaScannerConnection.scanFile() as of SDK 2.2+.

After taking an image and saving it on the sd card, how can I trigger scanning of images in SDKs lower than 2.2 (2.1 downwards)?

Upvotes: 0

Views: 279

Answers (1)

Peter Knego
Peter Knego

Reputation: 80340

There are two MediaScannerConnection.scanFile(..) methods. Use the one available since API 1.

// available since API 1
scanFile (String path, String mimeType)  

// available since API 8
scanFile (Context context, String[] paths, String[] mimeTypes, MediaScannerConnection.OnScanCompletedListener callback)

Upvotes: 1

Related Questions