public abstract static class WebChromeClient.FileChooserParams extends Object
Modifier and Type | Field and Description |
---|---|
static int |
MODE_OPEN
Open single file.
|
static int |
MODE_OPEN_FOLDER
Like Open but allows a folder to be selected.
|
static int |
MODE_OPEN_MULTIPLE
Like Open but allows multiple files to be selected.
|
static int |
MODE_SAVE
Allows picking a nonexistent file and saving it.
|
Constructor and Description |
---|
FileChooserParams() |
Modifier and Type | Method and Description |
---|---|
abstract Intent |
createIntent()
Creates an intent that would start a file picker for file selection.
|
abstract String[] |
getAcceptTypes()
Returns an array of acceptable MIME types.
|
abstract String |
getFilenameHint()
The file name of a default selection if specified, or null.
|
abstract int |
getMode()
Returns file chooser mode.
|
abstract CharSequence |
getTitle()
Returns the title to use for this file selector, or null.
|
abstract boolean |
isCaptureEnabled()
Returns preference for a live media captured value (e.g.
|
static Uri[] |
parseResult(int resultCode,
Intent data)
Parse the result returned by the file picker activity.
|
public static final int MODE_OPEN
public static final int MODE_OPEN_MULTIPLE
public static final int MODE_OPEN_FOLDER
public static final int MODE_SAVE
public static Uri[] parseResult(int resultCode, Intent data)
createIntent()
. Refer to createIntent()
for how to use it.resultCode
- the integer result code returned by the file picker activity.data
- the intent returned by the file picker activity.public abstract int getMode()
public abstract String[] getAcceptTypes()
public abstract boolean isCaptureEnabled()
getAcceptTypes
to determine suitable capture devices.public abstract CharSequence getTitle()
public abstract String getFilenameHint()
public abstract Intent createIntent()
How to use: 1. Build an intent usingcreateIntent()
2. Fire the intent usingActivity.startActivityForResult(android.content.Intent, int)
. 3. Check for ActivityNotFoundException and take a user friendly action if thrown. 4. Listen the result usingActivity.onActivityResult(int, int, android.content.Intent)
5. Parse the result usingparseResult(int, android.content.Intent)
only if media capture was not requested. 6. Send the result using filePathCallback ofWebChromeClient.onShowFileChooser(android.webkit.WebView, android.webkit.ValueCallback<android.net.Uri[]>, android.webkit.WebChromeClient.FileChooserParams)