Jo already found that out some months ago,
see this thread: In this link of the reference documentation it shows us in the end
How to: PICK FILES FROM THE SD CARD. It teaches us to use third party apps (AndExplorer), which for me has a lot of disadvantages.
So after some experimenting I discovered this trick.
After Menno now contacted me using the same technique, I tested again and can now confirm that it really works!
Precondition is, a file manager app is installed on your device, but any file manager should do it.
Thank you Jo and Menno!
This example picks a pdf file from your device and displays it with a pdf viewer.
You can adjust the example to your needs and pick other file types, too, e.g. to use this technique as an alternative image picker
or to pick a mp3 file, etc.
How it works:There are 2 activity starter used: ActivityStarterPick to pick a file using a file manager.
In the ActivityStarterPick.ResultUri the path to the file is supplied.
Then ActitiyStarterOpen opens another external app (pdf viewer) to display the pdf file.
Note: It has been reported by Marcello,
that you do not get the the file name like \media\bong.png with ES File Explorer. You get a content uri like \media\4578 instead.
You can use the GetFileName method from the File extension to convert a content uri into the path to the file.
I used File Manager from Rhyhm Software as example to pick a file here.
Tested successfully on Nexus 5 running Android 4.4.2.
Developing and maintaining snippets, tutorials and extensions for App Inventor takes a lot of time.
I hope it saved some of your time. If yes, then you might consider to donate a small amount!
or donate some mBTC to Address:
1Jd8kXLHu2Vkuhi15TWHiQm4uE9AGPYxi8
Thank you! Taifun
Download aia file for App Inventor
Back to top of page ...
This work by Pura Vida Apps
is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
with attribution (name=Pura Vida Apps and link to the source site) required.