OpenFileActivityBuilder | 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
  - Tools & Reference
  - Developer Stories

## Results

Loading...
Summary: Constants | Methods | Inherited Methods | [Expand All]
public class

# OpenFileActivityBuilder

extends Object

java.lang.Object
↳ | com.google.android.gms.drive.OpenFileActivityBuilder

## Class Overview

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 `#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.

## Summary

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
IntentSender | build(GoogleApiClient apiClient) 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)`.
OpenFileActivityBuilder | setActivityStartFolder(DriveId folder) Sets the folder that the Activity will display initially.
OpenFileActivityBuilder | setActivityTitle(String title) Sets the title displayed in the activity.
OpenFileActivityBuilder | setMimeType(String[] mimeTypes) Sets the MIME type filter which controls which kinds of files can be selected from the file picker.

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)

## Constants

#### public static final String EXTRA_RESPONSE_DRIVE_ID

A successful result will return an extra by this name which will contain the `DriveId` of the selected file.

Constant Value: "response_drive_id"

## Public Methods

#### public IntentSender build (GoogleApiClient apiClient)

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)`.

##### Parameters

apiClient | The `GoogleApiClient` to service the call. The client must be connected before invoking this method.

#### public OpenFileActivityBuilder setActivityStartFolder (DriveId folder)

Sets the folder that the Activity will display initially. If not specified, it will default to the root of "My Drive".

#### public OpenFileActivityBuilder setActivityTitle (String title)

Sets the title displayed in the activity.

##### Parameters

title | the title to set on the activity (may not be null)

#### public OpenFileActivityBuilder setMimeType (String[] mimeTypes)

Sets the MIME type filter which controls which kinds of files can be selected from the file picker. If this method is not called or if a zero-length array is provided, all non-folder files will be selectable.

##### Parameters

mimeTypes | the mime types to show in the picker. May not be null. If a zero-length array is provided, all non-folder files will be selectable