Android Add Image to Android Gallery App

Oct 4, 2018
Downloaded image doesn't show in gallery

Assuming your app could take picture using camera (or download images), and you want those images to appear in Android's Gallery app.

Java

MediaScannerConnection.scanFile(context, new String[]{file.getPath()}, new String[]{"image/jpeg"}, null);

Kotlin

MediaScannerConnection.scanFile(context, arrayOf(file.toString()), null, null)

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.