Я пытаюсь получить путь к файлу из своего видео uri.Как получить видео Путь к файлу из uri
Я прошел со следующими ссылками, но по-прежнему сталкивается этот вопрос:
get-filename-and-path-from-uri-from-mediastore
get-file-path-from-uri-from-video-chooser
Ниже мой код:
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);
содержание: // ком .android.providers.media.documents/document/video% 3A1142
Но всегда получайте путь к файлу null.
Ниже мои журналы:
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)
спасибо, его рабочий штраф –
Это потрясающе! Я, вероятно, пробовал предложения от 10 разных должностей, прежде чем найти ваш ответ. Дал бы ему +10, если бы мог. – wildcat12