我可以使用以下代码从 Google 云端硬盘下载原始文件:
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;
}
}
但在下载许多文件以添加到 GridView 时,连接似乎真的很低。
因此,我需要列出缩略图而不是原始文件,因为这样更利于连接。
请帮助我如何?
最佳答案
使用File.getThumbnail获取缩略图的方法或File.getIconLink获取图标链接。
关于android - 从 Google Drive 下载文件的缩略图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17673356/