I am trying to get file path from my video uri.
I have gone through with following links but still facing this issue:
get-filename-and-path-from-uri-from-mediastore
get-file-path-from-uri-from-video-chooser
Following is my code:
Uri imageUri = data.getData();
String[] proj = { MediaStore.Audio.Media.DATA };
Cursor cursor = PreferenceHelper.getContext().getContentResolver().query(imageUri, proj, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.DATA);
cursor.moveToFirst();
String filePath = cursor.getString(column_index);
sendVideo(activity, filePath, windowId, isChatroom);
content://com.android.providers.media.documents/document/video%3A1142
But always get file path null.
Following is my logs:
10-22 13:09:44.189 21604-21604/com.testapp.chat W/System.err: java.lang.NullPointerException
10-22 13:09:44.190 21604-21604/com.testapp.chat W/System.err: at java.io.File.fixSlashes(File.java:185)
10-22 13:09:44.191 21604-21604/com.testapp.chat W/System.err: at java.io.File.<init>(File.java:134)
10-22 13:09:44.191 21604-21604/com.testapp.chat W/System.err: at com.inscripts.plugins.VideoSharing.sendVideo(VideoSharing.java:125)
10-22 13:09:44.191 21604-21604/com.testapp.chat W/System.err: at com.inscripts.plugins.VideoSharing.sendVideo(VideoSharing.java:219)
10-22 13:09:44.192 21604-21604/com.testapp.chat W/System.err: at com.inscripts.plugins.VideoSharing.sendVideoOneOnOne(VideoSharing.java:104)
10-22 13:09:44.193 21604-21604/com.testapp.chat W/System.err: at com.inscripts.activities.SingleChatActivity.onButtonClick(SingleChatActivity.java:617)
10-22 13:09:44.193 21604-21604/com.testapp.chat W/System.err: at com.inscripts.custom.CustomAlertDialogHelper.onClick(CustomAlertDialogHelper.java:65)
10-22 13:09:44.193 21604-21604/com.testapp.chat W/System.err: at android.view.View.performClick(View.java:4456)
10-22 13:09:44.194 21604-21604/com.testapp.chat W/System.err: at android.view.View$PerformClick.run(View.java:18465)