0

Hello i am using this code ( https://stackoverflow.com/a/6772455/579646 ) to open an image in Gallery, but on android 2.2 and 2.3 it shows a me Toast saying "searching for new images and albums ..." and then after about 10 seconds of blank screen it finally shows my image. Plus if i change the image but leave the same file name, the gallery cache kicks in(or something like that) and i see the old image when zoomed out and new picture when zoomed it. The only fix is to use random name every time.

If i use this link https://stackoverflow.com/a/5814533/579646 then it opens faster but then i invade the gallery and it adds a folder to it. Is there a way to remove the folder after the user closes the gallery ?

How can i make Gallery open just one Image without scanning stuff and without adding some folder to the gallery by mediascanner ?

Thanks

Community
  • 1
  • 1
max4ever
  • 11,909
  • 13
  • 77
  • 115
  • do the hard work and edit the post instead of downvoting, english is not my native language smartass – max4ever Jul 10 '12 at 15:39

1 Answers1

0

Your best option is to create your own Activity for displaying an image within your app (answers to this question should help). You then have complete control over the actions it does. Create a simple activity that takes a path to the image and simply opens that path and displays the image in a full-screen ImageView.

I say this because there's not much you can do about Gallery updating its cache whenever it opens - once you move to a different activity, your app has no influence. And ACTION_VIEW is the correct Intent to be opening an image, but remember that users may not have the standard gallery as the default activityfor it. If they have a different default, the experience might not be so bad.

Community
  • 1
  • 1
hcarver
  • 7,126
  • 4
  • 41
  • 67
  • aren't those answers for SELECTING images? i don't need to scroll other images, just see one with the zoom and layout rotation thing – max4ever Jul 09 '12 at 09:59
  • Sorry, should have been more specific. This comment demonstrates displaying a specific image: http://stackoverflow.com/a/6543674/705048 – hcarver Jul 09 '12 at 11:14
  • Unfortunately, your options are to either implement your own image display or use `ACTION_VIEW` and put up with things you don't like about other implementations, so I'm recommending the first option! – hcarver Jul 09 '12 at 11:15