I want to upload a photo from the camera directly to the disk folder:
OutputStream outputStream = result.getDriveContents().getOutputStream(); ByteArrayOutputStream bitmapStream = new ByteArrayOutputStream(); image.compress(Bitmap.CompressFormat.PNG, 100, bitmapStream); try { outputStream.write(bitmapStream.toByteArray()); } catch (IOException e1) { Log.i(TAG, "Unable to write file contents."); }
So, I do it and work. The problem is that my photos on the disc are of very low quality and I need to have high quality video.
I already tried this solution Convert a bitmap to byteArray android
But then on Drive, the photo was not recognized as a multimedia file and cannot read it. Maybe I failed something.
EDIT: I did the exact same thing as https://stackoverflow.com/a/1671622/11 and did it to get the bitmap in the ActivityResult:
try { mBitmapToSave = MediaStore.Images.Media.getBitmap(this.getContentResolver(), data.getData()); } catch (IOException e) { e.printStackTrace(); }
source share