0

Here I trying to develop paint application based on specification. I used andengine and android both for this application development.

I can able to save user created image and load that particular image into canvas. These both operation work perfect for me. But when I open gallery view then it didn't show latest content of the image.

It shows data when it first time created in gallery view. But when I load that image it show correct image on canvas. I think it was a problem of gallery refresh so that I write following code for that purpose.

pexelMimics.sendBroadcast(new Intent(
                    Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"
                            + Environment.getExternalStorageDirectory())));

But this code can only able to show new created image into gallery but content update can't get reflected into gallery. I searched other post but I could not able to found useful content.

So my friends please help me to come out of it.

Siddharth
  • 4,142
  • 9
  • 44
  • 90

1 Answers1

0

MediaScanner may be helpful on this occasion.

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://your_file_path"
                        + Environment.getExternalStorageDirectory()))

It will scan whole external storage for searched media file.
Reference from here:

ridoy
  • 6,274
  • 2
  • 29
  • 60
  • Using above way, I try to refresh gallery but I couldn't get success. My file explorer show latest content of image but my load gallery view shows images old content. – Siddharth Jul 15 '13 at 18:36
  • you may use notifyDataSetChange() that interacts with UI.See some helpful info's http://stackoverflow.com/questions/7687723/update-android-image-gallery-with-newly-created-bitmap, http://stackoverflow.com/questions/15043401/image-not-showing-up-in-gallery – ridoy Jul 15 '13 at 20:16
  • Thanks, Yet I have not checked your both link so at present I will not reply you about this. But after research I found that I have to refresh thumbnail of the gallery. I have not checked this thing also but I want some suggestion from you that this was the reason for not getting latest content in gallery. – Siddharth Jul 17 '13 at 03:50
  • ya that is a point you need to look up,but have a try with those links i provided. – ridoy Jul 17 '13 at 06:35