I am trying to Load Images from gallery into my application folder. I am using Recyclerview
By using this Intent i am able to select Multiple Images from Gallery but don't know how to get images in my applications folder. Note I have different folders in my application.
private void OpenFromGallery() {
Intent intent = new Intent();
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), 1);`}
Hope it will works for you
Click here
Related
I am using this piece of code to get multiple images from gallery:
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
startActivityForResult(Intent.createChooser(intent, getString(R.string.select_image)), GALLERY_CODE);
But how do I restrict the number of images that can be picked? For example, I only want the user to pick at most 9 images.
I'm trying to load images from gallery using the following code
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE);
The code works fine, however by default it loads only the recent photos. I have to click the menu to go to the "images" that show all images. Is there a way for me to load the image so by default it shows all "images" instead of the recent photos. Thank you.
i need to open gallery and pick 1-n images OR 1-n videos (2 different intent) from Android's gallery, like the ACTION_PICK intent. How can I achieve that? There are some cool library on GitHub for multiple pick or custom gallery?
If you use API 18 or higher, you can add to your intent.putExtra like so:
Intent intent = new Intent();
intent.setType("image/*,video/*"); //For choosing both images and/or videos
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); //This should allow multiple selection
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Select Picture"), 1);
There is also a GitHub project to build your own GridView with multi selection
Read here
To pick multiple files from gallery you need to simply modify your intent. For example:
Intent i = new Intent();
i.setType("image/*");
i.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
i.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(
Intent.createChooser(intent,"Select"), 1);
Please note the i.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
I want to open a images folder with android built-in gallery.
For example, I have a folder path that contains images, i want to open it with gallery.
I am using this code, it opens the gallery that contains no images.
Any idea?
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(folderImages)),"image/*");
startActivityForResult(intent, 1);
Maybe try this one:
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, ""), 1)
I'm working on an app that needs to have the user select an image or video. On pre-2.1 devices, using ACTION_GET_CONTENT seems to work fine with multiple MIME types:
new Intent(Intent.ACTION_GET_CONTENT).setType("video/*, image/*")
However, on a Droid running 2.1, this gives a "There are no items in your collection". Using the same code with either "video/" or "image/" gives the desired result. Is there a way to get my 2.1 device to allow the user to select both types of content within a single Intent?
Putting the request into a function and then calling the function with onClick().
public void openGalleryImage(){
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Select Image "),
SELECT_IMAGE);
}
public void openGalleryVideo(){
Intent intent = new Intent();
intent.setType("video/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Select vVideo "),
SELECT_VIDEO);
}