0

I've a NOT well-know number of images in a sdcard folder.

I'd like to show them into a gridVew.

Every tutorial explain me how to load from and array of drawable resources if, but...

how to add 'n' images from a folder ?

It's impotant in my app, because images are saved/deleted dinamically by a long-life service, realizing a very interesting way of use of our app. At every 'action' on images, I'm able to force redraw of the grid, but ... I don't know how to add images to grid from disk 'on-the-fly'

Thanks in advance

PS: i'm browsing into related answers here into stackoverflow, but a lot of answers really don't answer to the problem itself ...

user
  • 86,916
  • 18
  • 197
  • 190
realtebo
  • 23,922
  • 37
  • 112
  • 189
  • 1
    Get the image File representation of those images and set them to your `GridView`. See http://stackoverflow.com/questions/5875790/android-how-to-get-image-files-from-directory-into-view-setbackgrounddrawable . Then check this http://www.coderanch.com/t/443531/Android/Mobile/display-Images-stored-sdcard – user Sep 12 '12 at 08:24
  • Searching "GridView ImageAdapter sdcard Android" returns something like that: http://mobile.dzone.com/news/displaying-images-sd-card – WarrenFaith Sep 12 '12 at 08:24
  • [this](http://stackoverflow.com/a/4771461/790439) answer explains how to get a drawable from external storage. – vikki Sep 12 '12 at 08:26
  • @WarrenFaith: this article is not right for me: it says ' In order to be bale to view thumbnails images from the SD Card, Android needs to create them first, hence you should start the Gallery application that comes preinstalled, and open the sdcard folder which will automatically create thumbnails for the images stored on your sdcard'. Simply i **cannot ask user to open media gallry every time an image is loaded**, please read the question before answert – realtebo Sep 12 '12 at 08:29
  • 2
    Than search for "read images from sdcard". Split your problem into subproblems and search for solutions. Please think before asking... – WarrenFaith Sep 12 '12 at 08:31
  • Yes, I'dont wanna a flame, sorry. My problem is yet a single problem: how to implement the 'public View getView' method of the image adapter. Actually I'm looking athe the second link from Luksprog, and this looks like usefull. I'll try and I'll say to you. Sorry again. – realtebo Sep 12 '12 at 08:37

1 Answers1

0

I'd like to thanks to Luksprog.

His comment link to http://www.coderanch.com/t/443531/Android/Mobile/display-Images-stored-sdcard

This code is perfectly working.

realtebo
  • 23,922
  • 37
  • 112
  • 189