java.lang.Object | |
↳ | com.google.android.gms.drive.OpenFileActivityBuilder |
A builder that is used to configure and display the open file activity. This activity displays files and folders from the user's Drive. The activity can be used to display all files in the Drive, not just those your application has access to. Your application will be given access to the selected file.
To display the activity, pass the result of build(GoogleApiClient)
to
#startIntentSenderForResult()
.
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 selected file. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Builds an
IntentSender from the builder attributes that can be used to start the Open
File activity using
startIntentSenderForResult(IntentSender, int, Intent, int, int, int) . | |||||||||||
Sets the folder that the Activity will display initially.
| |||||||||||
Sets the title displayed in the activity.
| |||||||||||
Sets the MIME type filter which controls which kinds of files are selectable in the file
picker.
| |||||||||||
Sets the
Filter that controls which files are selectable in the file picker. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
A successful result will return an extra by this name which will contain the DriveId
of the selected file.
Builds an IntentSender
from the builder attributes that can be used to start the Open
File activity using
startIntentSenderForResult(IntentSender, int, Intent, int, int, int)
.
This method requires authorization with at least one of the following scopes:
SCOPE_FILE
.
Parameters | |
---|---|
apiClient |
GoogleApiClient :
The GoogleApiClient to service the call. The client must be
connected before invoking this method.
|
Returns | |
---|---|
IntentSender |
Sets the folder that the Activity will display initially. If not specified, it will default to the root of "My Drive".
Parameters | |
---|---|
folder |
DriveId
|
Returns | |
---|---|
OpenFileActivityBuilder |
Sets the title displayed in the activity.
Parameters | |
---|---|
title |
String :
the title to set on the activity (may not be null)
|
Returns | |
---|---|
OpenFileActivityBuilder |
Sets the MIME type filter which controls which kinds of files are selectable in the file
picker. If neither this nor setSelectionFilter(Filter)
method is called,
all non-folder files will be selectable.
Note: this method cannot be used with setSelectionFilter(Filter)
, doing so will throw an
IllegalStateException on build(GoogleApiClient)
.
Parameters | |
---|---|
mimeTypes |
String :
the mime types to show in the picker. May not be null. Passing a zero-length
array is equivalent to not calling this method.
|
Returns | |
---|---|
OpenFileActivityBuilder |
Sets the Filter
that controls which files are selectable in the file picker.
Calling this method will override previous filters.
The default filter restricts selection to files only:
Filters.not(Filters.eq(SearchableField.MIME_TYPE, DriveFolder.MIME_TYPE))
Note: this method cannot be used with setMimeType(String[])
, doing so will throw an
IllegalStateException on build(GoogleApiClient)
. Instead plug the desired mimeTypes into a
corresponding filter.
Parameters | |
---|---|
filter |
Filter :
the Filter a file should match to be selectable. May not be null.
|
Returns | |
---|---|
OpenFileActivityBuilder |