2013-07-16 56 views
1

我可以使用下面的代碼下載從谷歌驅動器的原始文件:下載縮略圖

public static InputStream downloadFile(Drive service, File file) 
      throws IOException { 
     if (file.getDownloadUrl() != null && file.getDownloadUrl().length() > 0) { 
      try { 
       HttpResponse resp = service.getRequestFactory() 
         .buildGetRequest(new GenericUrl(file.getDownloadUrl())) 
         .execute(); 
       return resp.getContent(); 
      } catch (IOException e) { 
       // An error occurred. 
       e.printStackTrace(); 
       return null; 
      } 
     } else { 
      // The file doesn't have any content stored on Drive. 
      return null; 
     } 
    } 

但下載許多文件添加到網格視圖時,它看起來像連接非常低。

因此,我需要列出縮略圖而不是原始文件,因爲它會更好的連接。

請問我該怎麼做?

回答

1

使用File.getThumbnail方法獲取縮略圖或File.getIconLink獲取圖標鏈接。

+0

謝謝,我使用File.getIconLink是成功的,但我想獲取縮略圖。我有問題,請看這裏獲得它的更多細節。 [File.getThumnail爲null](http://stackoverflow.com/questions/17674008/android-google-drive-set-thumbnail-for-image-file) –

+0

@mirror塔:你需要調用File.getThumnailLink(as每個iOS API) –