我怎样才能通知的新形象在Android的画廊? [英] How can I notify the gallery of a new image in android?

查看:128
本文介绍了我怎样才能通知的新形象在Android的画廊?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Android应用程序,允许您使用意图图库您的手机上打开一个图像。你让修改的图像和应用程序在同一个文件夹中原来是在一个新的名称保存它。因为画廊不能不断地寻找新的图像有没有办法从通知的新形象的画廊我Android应用程序,因此用户打开画廊在下一次显示出来?

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 name in the same folder the original was in. Since the gallery can't constantly be looking for new images is there any way to notify the gallery of a new image from my android app so it shows up next time the user opens the gallery?

推荐答案

使用 MediaScannerConnection -

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

这篇关于我怎样才能通知的新形象在Android的画廊?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆