Skip to first unread message

Fulvio Filippini

unread,
Nov 16, 2015, 12:53:32 PM11/16/15
to MIT App Inventor Forum
Hello
I'm trying to build an app in which the user would be able to select an image and a sound (e.g. a comment recorder by the "Voice recorder" app) from the device's file manager.
I succeded quite easily to pick an image from device's gallery by the "imagepicker" block, to store it by TinyDB block and to show it by clicking on a button.
But I don't understand how to do to pick a mp3 file from device's file manager and then store this sound in the app.
Thank you for your help

Taifun

unread,
Nov 16, 2015, 1:00:23 PM11/16/15
to MIT App Inventor Forum

Fulvio Filippini

unread,
Nov 20, 2015, 6:13:50 AM11/20/15
to MIT App Inventor Forum
Thank you very much for your help ! Finally, I succeded by using the "ActivityStarter" block : look at the screen capture joined.
- step 1 : by a click on a button named "B_SoundPick" you preset an activity starter named "AS_SoundPick"
--- to open AndExplorer (this free app has to be installed on your android device)
--- to look for a file in the sd card
--- to check if AndExplorer exists, otherwise you show an alert pop-up by "Notifier1"
--- to launch the activity named "AS_SoundPick"
- step 2 : on your android device AndExplorer opens and you can navigate into the device's storage to select an mp3 file (but you can select any kind of file). At the end of your selection, the block "when AS_SoundPick .AfterActivity" begins to analyse the file you selected
--- the full path of the file (given by "AS_SoundPick/ResultUri") is checked to see if it is an mp3 file (notice the "downcase" filter that allows to accept files written MP3), otherwise you show an alert pop-up
--- the full path of the file is set as "source" to a player named "Lecteur1"
--- for purpose of control, I set also this path as "text" of a label named "mp3filename"
That's all ! I've put three buttons (B_play / B_pause / B_rewind) on my screen to start, stop and reset the sound of the mp3 file selected : IT WORKS GREAT !!! (checked on a Samsung phone and a Lenovo tablet)
MIT-AI2-soundpick.jpg
Reply all
Reply to author
Forward
0 new messages