Post Reply

Help with Gallery App

OP heahmad

16th May 2014, 08:52 PM   |  #1  
OP Senior Member
Thanks Meter: 9
 
105 posts
Join Date:Joined: Dec 2009
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: 335
 
339 posts
Join Date:Joined: May 2013
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: 9
 
105 posts
Join Date:Joined: Dec 2009
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
 
21 posts
Join Date:Joined: Feb 2012
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: 9
 
105 posts
Join Date:Joined: Dec 2009
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


Top Threads in Java for Android App Development by ThreadRank