I'm trying to get from an Android Uri to a byte array.
I have the following code, but it keeps telling me that the byte array is 61 bytes long, even though the file is quite large - so I think it may be turning the Uri string into a byte array, rather than the file :(
Log.d(LOG_TAG, "fileUriString = " + fileUriString);
Uri tempuri = Uri.parse(fileUriString);
InputStream is = cR.openInputStream(tempuri);
String str=is.toString();
byte[] b3=str.getBytes();
Log.d(LOG_TAG, "len of data is " + imageByteArray.length
+ " bytes");
Please can someone help me work out what to do?
The output is "fileUriString = content://media/external/video/media/53" and "len of data is 61 bytes".
Thanks!
cR
? You ask how to go "from a Uri to an InputStream" but you already got anInputStream
, without saying how you got it. – RobespierrecR
is an instance of ContentResolver class – Equipotential