Google 致力于为黑人社区推动种族平等。查看具体举措

OpenDocument

class OpenDocument : ActivityResultContract<Array<String!>!, Uri!>
kotlin.Any
   ↳ androidx.activity.result.contract.ActivityResultContract<kotlin.Array<kotlin.String>, android.net.Uri>
   ↳ androidx.activity.result.contract.ActivityResultContracts.OpenDocument

An ActivityResultContract to prompt the user to open a document, receiving its contents as a file:/http:/content: Uri.

The input is the mime types to filter by, e.g. image/*.

This can be extended to override createIntent if you wish to pass additional extras to the Intent created by super.createIntent().

Summary

Public constructors

An ActivityResultContract to prompt the user to open a document, receiving its contents as a file:/http:/content: Uri.

Public methods
open Intent
createIntent(@NonNull context: Context, @NonNull input: Array<String!>)

ActivityResultContract.SynchronousResult<Uri!>?
getSynchronousResult(@NonNull context: Context, @NonNull input: Array<String!>)

Uri?
parseResult(resultCode: Int, @Nullable intent: Intent?)

Public constructors

<init>

OpenDocument()

An ActivityResultContract to prompt the user to open a document, receiving its contents as a file:/http:/content: Uri.

The input is the mime types to filter by, e.g. image/*.

This can be extended to override createIntent if you wish to pass additional extras to the Intent created by super.createIntent().

Public methods

createIntent

@CallSuper @NonNull open fun createIntent(
    @NonNull context: Context,
    @NonNull input: Array<String!>
): Intent

getSynchronousResult

@Nullable fun getSynchronousResult(
    @NonNull context: Context,
    @NonNull input: Array<String!>
): ActivityResultContract.SynchronousResult<Uri!>?

parseResult

@Nullable fun parseResult(
    resultCode: Int,
    @Nullable intent: Intent?
): Uri?