我一直在尝试将纯文本文件保存到Android上Google云端硬盘中的特定文件夹中。将文件保存在Google Drive SDK的特定文件夹中
到目前为止使用我已经能够做到在正确的方向去的几件事情在谷歌云端硬盘中的文件和QuickStart Guide,首先,我能创造一个纯文本文件:
File body = new File();
body.setTitle(fileContent.getName());
body.setMimeType("text/plain");
File file = service.files().insert(body, textContent).execute();
我已经能够在谷歌Drive大道的根目录创建一个新的文件夹:
File body = new File();
body.setTitle("Air Note");
body.setMimeType("application/vnd.google-apps.folder");
File file = service.files().insert(body).execute();
我也一直能与列出的所有文件夹在用户的谷歌云端硬盘帐户:
List<File> files = service.files().list().setQ("mimeType = 'application/vnd.google-apps.folder'").execute().getItems();
for (File f : files) {
System.out.println(f.getTitle() + ", " + f.getMimeType());
}
但是,我有点卡住如何将文本文件保存到Google云端硬盘中的文件夹。
工作就像一个魅力,非常感谢你! =) – Gatekeeper
你如何获得“parentId”的保留? –
如果你知道你要去哪里商店,它几乎直截了当 – the100rabh