The code for this example is very simple: Intents
Public voidongetmusic (view view) {Intent Intent=NewIntent (intent.action_get_content); Intent.settype ("audio/*"); StartActivity (Intent.createchooser (Intent,"Select Music")); } Public voidongetimage (view view) {Intent Intent=NewIntent (intent.action_get_content); Intent.settype ("Image/*"); StartActivity (Intent.createchooser (Intent,"Select Image")); } Public voidongetstream (view view) {Intent Intent=NewIntent (intent.action_get_content); Intent.settype ("*/*"); StartActivity (Intent.createchooser (Intent,"Select Stream")); }
It uses intent.action_get_content and MIME types to find all data picker that support audio/*, allowing the user to select one of them.
For example, for an email application, the user is allowed to select a data file as an attachment.
Method Createchooser provides a convenient way to create a action_chooser intent.
Is the result of running on the emulator, there are two supported audio/* MIME:
"Sail Plan 021" 2015 Sail plan Android Apidemo The Devil step of the App->intents Createchooser