ACTION_GET_CONTENT except image and video files in Android - android

If we have to get the image file from device then we have to write following code:
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Choose Picture"), 1);
But what we have to do if we don't want to choose only image and video files.
I want that the file chooser window should show all the files except image and video.

Related

File picker not displaying text files

I am trying to pick a text file with a file picker. I am getting this error alert No apps can perform this action . My code is:
Intent intent = new Intent();
intent.setType("*/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE);
It also doesn't display text files if I use intent.setType("*/*");. How should I fix my problem?

How to load images from gallery "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.

How to load Images from Gallery in Recyclerview in android?

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

want video and library both in gallery in android

When picking a file from the Library, only photos are listed. Video files should also be shown.
Im Using this code
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(Intent.createChooser(intent, "Select Picture"),SELECT_PICTURE);
use following for pick both images and videos.
Intent mediaChooser =new Intent(Intent.ACTION_GET_CONTENT);
//comma-separated MIME types
mediaChooser.setType("video/*, images/*");
startActivityForResult(mediaChooser,IMAGE_PICK);

Android open folder image with built-in gallery

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)

Categories

Resources