Amelia
Amelia

Reputation: 25

How to make let the user select the location of the file which needs to be saved?

How do I make like this

When the user clicks to save the file an intent will get activated and tell the user where he wants to save that file

Upvotes: 1

Views: 520

Answers (1)

S-Sh
S-Sh

Reputation: 3873

There is Storage Access Framework to do exactly this. There is a pretty good description in the Official documentation, so I just provide the simplest sample right here:

const val CREATE_FILE = 1
val intent = Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
    addCategory(Intent.CATEGORY_OPENABLE)
}
startActivityForResult(intent, CREATE_FILE)

Upvotes: 1

Related Questions