Folders in the Drive API for Android are specialized resources with
metadata and
a DriveId
. They have a number of additional
methods designed to help with common folder operations.
Get the root folder
The root folder is a normal folder which can be retrieved using the
DriveResourceClient.getRootFolder()
method. It can then be used like any other folder.
Create a folder
To create a folder, call
DriveResourceClient.createFolder()
,
passing in a reference to the parent folder and the metadata object
containing the title and other attributes to set the values for the
folder.
The following code sample demonstrates how to create a new folder in the root folder:
Create file inside a folder
You can also create files inside of folders using the
DriveResourceClient.createFile()
method. This process the same as
creating files in the root
folder. You can also pass metadata and contents for the file to the
createFile()
method.
Search a folder's contents
In addition to listing direct children, you can retrieve the collection
of the metadata for the files and folders within a folder using the
DriveResourceClient.queryChildren()
method.
Store application specific files in the App Folder
The App Folder is a special folder that is hidden from users and other applications. It allows you to store files that users should not modify, such as a configuration files. For more information, read Storing Application Data.