Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,741,801 Members 44,189 Now Online
XDA Developers Android and Mobile Development Forum

Help with Gallery App

Tip us?
 
heahmad
Old
#1  
Senior Member - OP
Thanks Meter 8
Posts: 104
Join Date: Dec 2009
Default Help with Gallery App

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!
 
SimplicityApks
Old
#2  
SimplicityApks's Avatar
Senior Member
Thanks Meter 308
Posts: 287
Join Date: May 2013
Location: Aachen
Quote:
Originally Posted by heahmad View Post
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: [ Click to Expand ]
 
heahmad
Old
#3  
Senior Member - OP
Thanks Meter 8
Posts: 104
Join Date: 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
 
zipzip27
Old
#4  
Junior Member
Thanks Meter 15
Posts: 21
Join Date: Feb 2012
Location: Ho Chi Minh
Quote:
Originally Posted by heahmad View Post
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: [ Click to Expand ]
 
heahmad
Old
#5  
Senior Member - OP
Thanks Meter 8
Posts: 104
Join Date: Dec 2009
Quote:
Originally Posted by zipzip27 View Post
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes