0

I want the following functionality:

In my application's internal storage I have a file and the user should be able to save it to another app (ex. Google Drive) OR save it to the phone's external storage by selecting a directory. Right now I can achieve this by two different methods, one displaying a chooser with the other apps, one opening a directory picker (ACTION_OPEN_DOCUMENT_TREE intent)

My question is that is it possible to have a chooser that would contain all the app's that could save the file (ex. Google Drive, OneDrive, etc.), INCLUDING the phone's file manager so if the user selects that option he can choose a directory?

Right now the ACTION_SEND intent doesn't contain the file manager.

1
  • one displaying a chooser Pretty unclear what kind of chooser. Tell more. Commented Sep 19, 2023 at 11:19

1 Answer 1

1

Intent.createChooser() can take a list of intents.

Have a look at

chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentsList.toArray(new Parcelable[]{}));
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! I managed to make it work with this solution. :D One question though, is it possible to detect somehow which intent was triggered from the list that was passed to the chooser?
Well only ACTION_OPEN_DOCUMENT_TREE will trigger an onActivityResult with an uri as far as i know. What do you need more? ACTION_SEND will not inform you.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.