Displaying images from a specific folder on the SDCard using a gridview

后端 未结 6 1811
北海茫月
北海茫月 2020-11-27 17:26

I\'m attempting to create a gridview that is loaded with images from a specific folder that resides on an SDCard. The path to the folder is known, (\"/sdcard/pictures\") , b

6条回答
  •  臣服心动
    2020-11-27 18:29

    read this link: http://androidsamples.blogspot.com/2009/06/how-to-display-thumbnails-of-images.html
    it shows how to use both mediastore and bitmapfactory.

    the way you should chose depends on what exactly you need. if you have a static set of images, it's much better idea to put them to drawables, i think, cause this way it's faster and you don't rely on sd card, which can be removed, corrupt or files could be renamed/deleted

    if images are dynamic, then use mediastore or bitmap factory. but keep in mind that putting images into array or something it's quite memory consuming, so you can end up having outofmemory exception

提交回复
热议问题