Google is committed to advancing racial equity for Black communities. See how.

CreateDocument

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

An ActivityResultContract to prompt the user to select a path for creating a new document, returning the content: Uri of the item that was created.

The input is the suggested name for the new file.

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 select a path for creating a new document, returning the content: Uri of the item that was created.

Public methods
open Intent
createIntent(@NonNull context: Context, @NonNull input: String)

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

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

Public constructors

<init>

CreateDocument()

An ActivityResultContract to prompt the user to select a path for creating a new document, returning the content: Uri of the item that was created.

The input is the suggested name for the new file.

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: String
): Intent

getSynchronousResult

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

parseResult

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