Selecting images and videos on Android 2.1 with ACTION_GET_CONTENT

I am working on an application that should select a user for an image or video. On pre-2.1 devices, using ACTION_GET_CONTENT seems to work fine with several MIME types:

new Intent(Intent.ACTION_GET_CONTENT).setType("video/*, image/*") 

However, on Droid version 2.1, this gives "There are no items in your collection." Using the same code with "video /" or "image /" gives the desired result. Is there a way to get my device 2.1 to allow the user to select both types of content within the same Intent?

+4
source share
2 answers

Has this problem been resolved? Can you select only one video or image or can you select multiple videos or images?

0
source

Putting a request into a function and then calling the function using 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); } 
0
source

Source: https://habr.com/ru/post/1308835/


All Articles