FORUMS

Help with Gallery App

126 posts
Thanks Meter: 26
 
By heahmad, Senior Member on 16th May 2014, 08:52 PM
Post Reply Subscribe to Thread Email Thread
I have found a gallery app that I have integrated into my own app.
http://manishkpr.webheavens.com/andr...swipe-gallery/
Currently the gallery displays images that are founded in drawable i want to modify it to show image from sd card (i.e. /sd/images/)
I tried different approach but without luck, unfortunately.

Thanks in advance!
 
 
17th May 2014, 12:58 PM |#2  
SimplicityApks's Avatar
Senior Member
Flag Aachen
Thanks Meter: 343
 
More
Quote:
Originally Posted by heahmad

I have found a gallery app that I have integrated into my own app.
http://manishkpr.webheavens.com/andr...swipe-gallery/
Currently the gallery displays images that are founded in drawable i want to modify it to show image from sd card (i.e. /sd/images/)
I tried different approach but without luck, unfortunately.

Thanks in advance!

You have to use BitmapFactory.decodeFile() on each File in that directory. You can then set the returned bitmap to your imageView in the instantiateItem() method of your PagerAdapter with setImageBitmap(). Though you might want to cache thing first for better performance...
The Following User Says Thank You to SimplicityApks For This Useful Post: [ View ]
17th May 2014, 01:33 PM |#3  
OP Senior Member
Thanks Meter: 26
 
More
ok i know that, but the problem is that the app itself generate photos with different number and name (Timestamp) so i want it to read an entire folder not a single file each time
18th May 2014, 06:08 PM |#4  
Junior Member
Flag Ho Chi Minh
Thanks Meter: 16
 
More
Quote:
Originally Posted by heahmad

ok i know that, but the problem is that the app itself generate photos with different number and name (Timestamp) so i want it to read an entire folder not a single file each time

you can get all images from diretory

PHP Code:
File file= new File(android.os.Environment.getExternalStorageDirectory(),"MyFolder");

        if (
file.isDirectory())
        {
            
listFile file.listFiles();


            for (
int i 0listFile.lengthi++)
            {

                
f.add(listFile[i].getAbsolutePath());

            }
        } 
The Following User Says Thank You to zipzip27 For This Useful Post: [ View ]
19th May 2014, 06:50 AM |#5  
OP Senior Member
Thanks Meter: 26
 
More
Quote:
Originally Posted by zipzip27

you can get all images from diretory

PHP Code:
File file= new File(android.os.Environment.getExternalStorageDirectory(),"MyFolder");

        if (
file.isDirectory())
        {
            
listFile file.listFiles();


            for (
int i 0listFile.lengthi++)
            {

                
f.add(listFile[i].getAbsolutePath());

            }
        } 

i do not get it can you explain more, there is no return function with data
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes