Search code examples
androidandroid-intentandroid-imageandroid-gallery

Android open gallery from folder


I want to show a photo in android gallery, and be able to slide throw the others photos on that folder.

Intent intent = new Intent(Intent.ACTION_VIEW);
File f = new File(path);
intent.setDataAndType(Uri.parse("file://" + f.getAbsolutePath()), "image/*");
mContext.startActivity(intent);

thats how i am doing it now, but wont let me slide throw the rest of the images in the folder. i tried:

How to open one particular folder from gallery in android?

Built-in gallery in specific folder

Gallery with folder filter

Without any luck. i would be really happy if someone have the solution. Thanks!


Solution

  • Try This

    Intent i=new Intent();
    i.setAction(Intent.ACTION_VIEW);
    i.setDataAndType(Uri.fromFile(new File(path)), "image/*");  
    startActivity(i);
    

    See these Links

    How can I use Intent.ACTION_VIEW to view the contents of a folder?

    Android ACTION_VIEW Multiple Images

    Java and Android: How to open several files with an Intent?

    if this solves your problem. Also check

    https://www.google.co.in/?gfe_rd=cr&ei=c5n9U6ruE7DO8gfXz4G4BA&gws_rd=ssl#q=view+like+gallery

    also check Gallery widget