Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#constants) \| [Ctors](https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#pubctors) \| [Methods](https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#inhmethods)

# WebChromeClient.FileChooserParams

*** ** * ** ***

` public static abstract class WebChromeClient.FileChooserParams `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.webkit.WebChromeClient.FileChooserParams |

<br />

*** ** * ** ***

Parameters used in the `https://developer.android.com/reference/android/webkit/WebChromeClient#onShowFileChooser(android.webkit.WebView,%20android.webkit.ValueCallback<android.net.Uri[]>,%20android.webkit.WebChromeClient.FileChooserParams)` method.

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN` Open single file. |
| `int` | `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_FOLDER` Like Open but allows a folder to be selected. |
| `int` | `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE` Like Open but allows multiple files to be selected. |
| `int` | `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE` Allows picking a nonexistent file and saving it. |
| `int` | `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#PERMISSION_MODE_READ` File or directory should be opened for reading only. |
| `int` | `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#PERMISSION_MODE_READ_WRITE` File or directory should be opened for read and write. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#FileChooserParams()() ` |

| ### Public methods ||
|---|---|
| ` abstract https://developer.android.com/reference/android/content/Intent` | ` https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#createIntent()() ` Creates an intent that would start a file picker for file selection. |
| ` abstract https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#getAcceptTypes()() ` Returns an array of acceptable MIME types. |
| ` abstract https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#getFilenameHint()() ` The file name of a default selection if specified, or `null`. |
| ` abstract int` | ` https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#getMode()() ` Returns file chooser mode. |
| ` int` | ` https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#getPermissionMode()() ` Returns permission mode `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#PERMISSION_MODE_READ` or `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#PERMISSION_MODE_READ_WRITE` which indicates the intended mode for opening a file or directory. |
| ` abstract https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#getTitle()() ` Returns the title to use for this file selector. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#isCaptureEnabled()() ` Returns preference for a live media captured value (e.g. Camera, Microphone). |
| ` static https://developer.android.com/reference/android/net/Uri` | ` https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#parseResult(int,%20android.content.Intent)(int resultCode, https://developer.android.com/reference/android/content/Intent data) ` Parse the result returned by the file picker activity. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Constants

### MODE_OPEN

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MODE_OPEN
```

Open single file. Requires that the file exists before allowing the user to pick it.

<br />

Constant Value: 0 (0x00000000)

### MODE_OPEN_FOLDER

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MODE_OPEN_FOLDER
```

Like Open but allows a folder to be selected.

<br />

Constant Value: 2 (0x00000002)

### MODE_OPEN_MULTIPLE

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MODE_OPEN_MULTIPLE
```

Like Open but allows multiple files to be selected.

<br />

Constant Value: 1 (0x00000001)

### MODE_SAVE

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MODE_SAVE
```

Allows picking a nonexistent file and saving it.

<br />

Constant Value: 3 (0x00000003)

### PERMISSION_MODE_READ

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int PERMISSION_MODE_READ
```

File or directory should be opened for reading only.

<br />

Constant Value: 0 (0x00000000)

### PERMISSION_MODE_READ_WRITE

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int PERMISSION_MODE_READ_WRITE
```

File or directory should be opened for read and write.

<br />

Constant Value: 1 (0x00000001)

## Public constructors

### FileChooserParams

```
public FileChooserParams ()
```

<br />

<br />

## Public methods

### createIntent

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract Intent createIntent ()
```

Creates an intent that would start a file picker for file selection. The Intent supports choosing files from simple file sources available on the device. Some advanced sources (for example, live media capture) may not be supported and applications wishing to support these sources or more advanced file operations should build their own Intent.

How to use:

1. Build an intent using `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#createIntent()`
2. Fire the intent using `https://developer.android.com/reference/android/app/Activity#startActivityForResult(android.content.Intent,%20int)`.
3. Check for ActivityNotFoundException and take a user friendly action if thrown.
4. Listen the result using `https://developer.android.com/reference/android/app/Activity#onActivityResult(int,%20int,%20android.content.Intent)`
5. Parse the result using `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#parseResult(int,%20android.content.Intent)` only if media capture was not requested.
6. Send the result using filePathCallback of `https://developer.android.com/reference/android/webkit/WebChromeClient#onShowFileChooser(android.webkit.WebView,%20android.webkit.ValueCallback<android.net.Uri[]>,%20android.webkit.WebChromeClient.FileChooserParams)`

**Note:** The created intent may be handled by third-party applications on device. The received result must be treated as untrusted as it can contain Uris pointing to your own app's sensitive data files. Your app should check the resultant Uris in `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#parseResult(int,%20android.content.Intent)` before calling the `filePathCallback`.

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/Intent` | an Intent that supports basic file chooser sources. <br /> |

### getAcceptTypes

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract String[] getAcceptTypes ()
```

Returns an array of acceptable MIME types. The returned MIME type could be partial such as audio/\*. The array will be empty if no acceptable types are specified.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | <br /> |

### getFilenameHint

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract String getFilenameHint ()
```

The file name of a default selection if specified, or `null`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | <br /> |

### getMode

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract int getMode ()
```

Returns file chooser mode.

<br />

| Returns ||
|---|---|
| `int` | Value is one of the following: - `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN` - `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE` - `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_FOLDER` - `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE` |

### getPermissionMode

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getPermissionMode ()
```

Returns permission mode `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#PERMISSION_MODE_READ` or `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#PERMISSION_MODE_READ_WRITE` which indicates the intended mode for opening a file or directory. This can be used to determine whether an Intent such as `https://developer.android.com/reference/android/content/Intent#ACTION_OPEN_DOCUMENT` should be used rather than `https://developer.android.com/reference/android/content/Intent#ACTION_GET_CONTENT` to choose files.

<br />

| Returns ||
|---|---|
| `int` | Value is one of the following: - `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#PERMISSION_MODE_READ` - `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#PERMISSION_MODE_READ_WRITE` |

### getTitle

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract CharSequence getTitle ()
```

Returns the title to use for this file selector. If `null` a default title should be used.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | <br /> |

### isCaptureEnabled

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean isCaptureEnabled ()
```

Returns preference for a live media captured value (e.g. Camera, Microphone). True indicates capture is enabled, `false` disabled. Use `getAcceptTypes` to determine suitable capture devices.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### parseResult

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Uri[] parseResult (int resultCode, 
                Intent data)
```

Parse the result returned by the file picker activity. This method should be used with `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#createIntent()`. Refer to `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#createIntent()` for how to use it.

**Note:** The intent returned by the file picker activity should be treated as untrusted. A third-party app handling the implicit intent created by `https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#createIntent()` might return Uris that the third-party app itself does not have access to, such as your own app's sensitive data files. WebView does not enforce any restrictions on the returned Uris. It is the app's responsibility to ensure that the untrusted source (such as a third-party app) has access the Uris it has returned and that the Uris are not pointing to any sensitive data files.

<br />

<br />

| Parameters ||
|---|---|
| `resultCode` | `int`: the integer result code returned by the file picker activity. <br /> |
| `data` | `Intent`: the intent returned by the file picker activity. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/Uri` | the Uris of selected file(s) or `null` if the resultCode indicates activity canceled or any other error. <br /> |