I can open the gallery with this code,
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("video/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Video"), PICK_VIDEO_REQUEST );
It works well on a Samsung Galaxy S5. But in some phones, images are displayed along with videos.
What changes do I need to do to the code to open the gallery to display only videos?
How can I get the real path of the selected video when the results are returned?
Use this
Here is the full code to get the video path after selecting from gallery.
Below code works for me:
and in onActivityResult:
Method
FarayanUtility.getRealPathFromUri
is:if the getpath() function is returning "null" then its prolly cuz you haven't set the permissions right. What you need to do is in your manifest paste this:
Paste this before the
<application>
tag, then, once you load your app, go to settings->applications-> YourApp ->permissions and then set all the permissions to true. Once you do that, this code should work perfectly