If anyone can help I would be really awesome. I am building an app where by I am trying to access my files and display them in an imageview.
I have a button and to that I attach an onClickListener
iButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent photoPickerIntent = new Intent(Intent.ACTION_GET_CONTENT);
photoPickerIntent.setType("image/*");
startActivityForResult(Intent.createChooser(photoPickerIntent, "Select Picture"), 1);
}
});
The intent gives me 3 options Gallery, Dropbox and Google Drive
For the Gallery I am able to access the file lis this and display it in the imageview
Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(selectedImage,filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
imageHolder.setImageBitmap(BitmapFactory.decodeFile(picturePath));
For Dropbox I do it like this
imageHolder.setImageBitmap(BitmapFactory.decodeFile(selectedImage.getPath()));
However I am unsure of how to do it for google drive i tried to do it like the gallery but I get the following error
E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /: open failed: EISDIR (Is a directory)
Any help would be very appreciated.
content://com.google.android.apps.docs.files/exposed_content/[base64-encoded-bytes]
.[base64-encoded-bytes]
is in fact a reversed, line-feed-and-semi-colon separated URL-encoded string, eg.123...%3D%3D%0A%3B456...
should be decoded into456...123...==
Base64-decoding456...123...==
results in 64 bytes of data, but I can't understand what those bytes are. Here's an example of the resulting 64-bytes I got: cl.ly/3Y2C1s0v3O0Q And it doesn't make more sense in HEX: goo.gl/7WV9K – Guillaume Boudreau