简体   繁体   中英

Images captured from my Android app are saved, but not displayed on the gallery app

I have build an Android application which capture images and save in the /mnt/sdcard/Pictures/MyFolder Actually application is running perfectly and also images store in the given path. The problem is I cannot see the images till I restart the device. Can I handle the situation in my coding?

Thanks in advance.

If what you mean is that you cannot see the images in your gallery app you can use this to fix it:

String[] paths = { "/mnt/sdcard/Pictures/MyFolder" };
String[] mediaType = {"image/jpeg"};
MediaScannerConnection.scanFile(this, paths, mediaType, null);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM