java.lang.Object | |
↳ | com.google.android.gms.drive.CreateFileActivityBuilder |
A builder that is used to configure and display the create file activity. This dialog creates a new file in the user's drive with a destination and title selected by the user, and the initial metadata and contents specified in this builder. If the device is currently offline, the file will be created locally and committed to the server when connectivity is restored.
To create a new DriveFile
, create a Contents
object using
newContents(GoogleApiClient)
and use it to write the file content and
MetadataChangeSet.Builder
to create the associated metadata and set them on the builder
using setInitialContents(Contents)
and setInitialMetadata(MetadataChangeSet)
before building.
To create a new DriveFolder
, create a metadata change set using
MetadataChangeSet.Builder
and be sure to set the MIME type to
MIME_TYPE
. Store this metadata on the activity builder using
setInitialMetadata(MetadataChangeSet)
. No Contents
should be set on the builder.
To display the activity, pass the result of build(GoogleApiClient)
to #startActivityForResult()
.
When the activity completes, a successful response will include an extra
EXTRA_RESPONSE_DRIVE_ID
with the selected DriveId
.
Note: you cannot use #startActivity
to invoke the activity. This will fail.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | EXTRA_RESPONSE_DRIVE_ID | A successful result will return an extra by this name which will contain the DriveId
of the created file. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Gets an Intent that can be used to start the Create File activity.
| |||||||||||
Sets the default folder that will be presented at activity startup as the location for
file creation.
| |||||||||||
Sets the title displayed in the activity.
| |||||||||||
Sets the initial contents for the new file.
| |||||||||||
Sets the default metadata for the new file.
|
[Expand]
Inherited Methods | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
A successful result will return an extra by this name which will contain the DriveId
of the created file.
Gets an Intent that can be used to start the Create File activity. Note that you must start
this activity with startActivityForResult
, not startActivity
. Once this is
invoked, the provided contents are finalized and cannot be edited. To make additional edits,
reopen the contents with the returned DriveId.
apiClient | The GoogleApiClient to service the call. The client must be connected
before invoking this method.
|
---|
Sets the default folder that will be presented at activity startup as the location for file creation. The activity supports navigation from this point to other folders.
Sets the title displayed in the activity.
title | the title to set on the activity (may not be null) |
---|
Sets the initial contents for the new file. This will close the contents, and persist them as the initial contents for the file. To continue editing the contents, reopen them once the file has been created.
Sets the default metadata for the new file.