How do I get the file path from the content URI for video files?
I want to attach images or video files from the Android storage. When I select a video from the gallery, it returns the content uri path . How do I get the file path with extension from the content URI? I tried following code, but it returns null in lollipop: void pickVideo() { Intent videoIntent = new Intent(Intent.ACTION_GET_CONTENT); videoIntent.setType("video/*"); startActivityForResult(videoIntent, PICK_VIDEO_FILE); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); try { if (resultCode !=