androidandroid-cameraandroid-contentproviderandroid-fileproviderandroid-video-record

Add video path to file provider paths


How can I add video captured path in File Provider? I am getting Content Uri form FileProvider. The video I caputure using default Camera App returns File Uri on Android 6.0, for which content resolver returns null. I want to read video size from the content resolver cursor.getColumnIndex(OpenableColumns.SIZE). How can I handle this issue?


Solution

  • If the scheme of the Uri is file, call new File(uri.getPath()).length() to get the length of the file. This should work if you have read access to the file.