3

Im currently using Google Drive REST API in order to create folder/files in my Drive.

However i would like to know how could i use the rest api to display an image from Drive in my app ? Is that even possible ?

 iv = (ImageView) myFragmentView.findViewById(R.id.imageView1);
    iv.setImageURI(Uri.parse("https://drive.google.com/uc?export=view&id={fileid}"));

This doesnt work i have nothing displayed on my screen.

Hugo Houyez
  • 470
  • 3
  • 19
  • Possible duplicate of [Displaying files (e.g. images) stored in Google Drive on a website](http://stackoverflow.com/questions/10311092/displaying-files-e-g-images-stored-in-google-drive-on-a-website) – LychmanIT Aug 18 '16 at 15:24
  • Did you solved this problem? I'm facing the same issue at the present moment... – Alex_ES Sep 19 '17 at 08:24

1 Answers1

0

I've not been able to figure out a way of doing this using the id or the URL...

However, if you are using the Google Script, you could try a solution similar to this:

var file = DriveApp.getFileById(fileId)
var base64CodedFile = Utilities.base64Encode(file.getBlob().getBytes());

and use that base64 variable to be sent to your app. With this format you will find a way of displaying your images (don't know Picasso, but Fresco library can do it easily...)

It is not an immediate solution, and requires to do somework in other platform that is not your Android app, but it works perfectly.

Alex_ES
  • 205
  • 2
  • 15