DriveFolder | Android Developers

Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

Language
close

- - About
  - Wear
  - TV
  - Auto
- - Get Started
  - Devices
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
  - Google Services
  - Samples
- - Google Play
  - Essentials
  - Get Users
  - Engage & Retain
  - Monetize
  - Analyze
  - Tools & Reference
  - Developer Stories

## Results

Loading...
Summary: Nested Classes | Constants | Methods | Inherited Methods | [Expand All]
public interface

# DriveFolder

implements DriveResource

com.google.android.gms.drive.DriveFolder

## Class Overview

A folder in Drive. This class provides methods to list or query the contents of the folder, or create new resources within it.

To retrieve a DriveFolder from a known Drive ID, use `getFolder(GoogleApiClient, DriveId)`.

## Summary

Nested Classes
interface | DriveFolder.DriveFileResult | A result that contains a `DriveFile`.
interface | DriveFolder.DriveFolderResult | A result that contains a `DriveFolder`.

Constants
String | MIME_TYPE | The MIME type associated with folder resources.

Public Methods
abstract PendingResult<DriveFolder.DriveFileResult> | createFile(GoogleApiClient apiClient, MetadataChangeSet changeSet, DriveContents driveContents, ExecutionOptions executionOptions) Creates a new binary file within this folder, with the provided initial metadata and `DriveContents`.
abstract PendingResult<DriveFolder.DriveFileResult> | createFile(GoogleApiClient apiClient, MetadataChangeSet changeSet, DriveContents driveContents) Creates a new binary file within this folder, with the provided initial metadata and `DriveContents`.
abstract PendingResult<DriveFolder.DriveFolderResult> | createFolder(GoogleApiClient apiClient, MetadataChangeSet changeSet) Creates a new folder within this folder, with the provided initial metadata.
abstract PendingResult<DriveApi.MetadataBufferResult> | listChildren(GoogleApiClient apiClient) Retrieves a collection of metadata for the direct children of this folder.
abstract PendingResult<DriveApi.MetadataBufferResult> | queryChildren(GoogleApiClient apiClient, Query query) Retrieves a collection of metadata for the files and folders that match the specified query and are direct children of this folder

[Expand] Inherited Methods
From interface com.google.android.gms.drive.DriveResource
abstract PendingResult<Status> | addChangeListener(GoogleApiClient apiClient, ChangeListener listener) Adds a new listener for changes on this resource.
abstract PendingResult<Status> | addChangeSubscription(GoogleApiClient apiClient) Adds a change subscription for this resource that will deliver events to the application event service.
abstract DriveId | getDriveId() Returns the DriveId that uniquely identifies this resource.
abstract PendingResult<DriveResource.MetadataResult> | getMetadata(GoogleApiClient apiClient) Retrieves the Metadata associated with this resource.
abstract PendingResult<DriveApi.MetadataBufferResult> | listParents(GoogleApiClient apiClient) Retrieves a collection of metadata for all of the parents of this resource that the calling app has been authorized to view.
abstract PendingResult<Status> | removeChangeListener(GoogleApiClient apiClient, ChangeListener listener) Removes a listener for changes on this resource that was previously added by `addChangeListener(GoogleApiClient, ChangeListener)`.
abstract PendingResult<Status> | removeChangeSubscription(GoogleApiClient apiClient) Removes any existing change subscription for this resource.
abstract PendingResult<Status> | setParents(GoogleApiClient apiClient, Set<DriveId> parentIds) Sets the parents of this resource.
abstract PendingResult<Status> | trash(GoogleApiClient apiClient) Moves the resource to trash.
abstract PendingResult<Status> | untrash(GoogleApiClient apiClient) Moves the resource out of the trash.
abstract PendingResult<DriveResource.MetadataResult> | updateMetadata(GoogleApiClient apiClient, MetadataChangeSet changeSet) Updates the Metadata that is associated with this resource with the changes described in the `MetadataChangeSet`.

## Constants

#### public static final String MIME_TYPE

The MIME type associated with folder resources.

Constant Value: "application/vnd.google-apps.folder"

## Public Methods

#### public abstract PendingResult<DriveFolder.DriveFileResult> createFile (GoogleApiClient apiClient, MetadataChangeSet changeSet, DriveContents driveContents, ExecutionOptions executionOptions)

Creates a new binary file within this folder, with the provided initial metadata and `DriveContents`. See `DriveFile` for more details on binary files.

##### Parameters

apiClient | The `GoogleApiClient` to service the call. The client must be connected before invoking this method.
changeSet | A set of metadata fields that should be initially set. This must minimally include a title and mime type.
driveContents | The initial contents. The provided contents must have been obtained through `newDriveContents(GoogleApiClient)`. This `DriveContents` cannot be reused after this method returns. This parameter may also be set to `null` to create an empty file, but it is recommended to create non-empty files where the mime-type does not support having a zero byte file (for example, image or PDF files).
executionOptions | A set of options for this method execution, such as whether to send an event when the action has completed on the server. See `ExecutionOptions` for more details. `setConflictStrategy(int)` is not supported for this method. When `null` is provided, this method will use default `ExecutionOptions`, that is no completion event requested and no operation tag.

##### Returns

- A PendingResult which can be used to retrieve the newly created DriveFile.

#### public abstract PendingResult<DriveFolder.DriveFileResult> createFile (GoogleApiClient apiClient, MetadataChangeSet changeSet, DriveContents driveContents)

Creates a new binary file within this folder, with the provided initial metadata and `DriveContents`. See `DriveFile` for more details on binary files.

This method behaves like `createFile(GoogleApiClient, MetadataChangeSet, DriveContents, ExecutionOptions)` with `null` `ExecutionOptions`, which means no completion event requested and no operation tag.

##### Parameters

apiClient | The `GoogleApiClient` to service the call. The client must be connected before invoking this method.
changeSet | A set of metadata fields that should be initially set. This must minimally include a title and mime type.
driveContents | The initial contents. The provided contents must have been obtained through `newDriveContents(GoogleApiClient)`. This `DriveContents` cannot be reused after this method returns. This parameter may also be set to `null` to create an empty file, but it is recommended to create non-empty files where the mime-type does not support having a zero byte file (for example, image or PDF files).

##### Returns

- A PendingResult which can be used to retrieve the newly created DriveFile.

#### public abstract PendingResult<DriveFolder.DriveFolderResult> createFolder (GoogleApiClient apiClient, MetadataChangeSet changeSet)

Creates a new folder within this folder, with the provided initial metadata.

##### Parameters

apiClient | The `GoogleApiClient` to service the call. The client must be connected before invoking this method.
changeSet | A set of metadata fields that should be initially set. This must minimally include a title. The mime type will be set to the folder mime type.

##### Returns

- A PendingResult which can be used to retrieve the newly created DriveFolder.

#### public abstract PendingResult<DriveApi.MetadataBufferResult> listChildren (GoogleApiClient apiClient)

Retrieves a collection of metadata for the direct children of this folder. The result will include metadata for both files and folders.

##### Parameters

apiClient | The `GoogleApiClient` to service the call.

##### Returns

- A PendingResult which can be used to retrieve the children list. Be sure to call `release()` when you're done with the result.

#### public abstract PendingResult<DriveApi.MetadataBufferResult> queryChildren (GoogleApiClient apiClient, Query query)

Retrieves a collection of metadata for the files and folders that match the specified query and are direct children of this folder

##### Parameters

apiClient | The `GoogleApiClient` to service the call.
query | A query that will restrict the results of the retrieved children.

##### Returns

- A PendingResult which can be used to retrieve the children list. Be sure to call `release()` when you're done with the result.