Android Question Open specified folder - intent

mirekk36

Member
Licensed User
Longtime User
Hi,

I would like to open a specified folder for example

file.DirRootExternal&/myfolder/"

with default android applications like "My Files" or something else

I try with such code

B4X:
    Dim i As Intent
    i.Initialize(i.ACTION_VIEW, "file://" &  File.DirRootExternal&"/myFolder/" )
    StartActivity(i)

but there is error
 

mirekk36

Member
Licensed User
Longtime User
There isn't any app that can handle this intent. You might be able to open the folder if you use SetComponent to start a specific file manager.
thx, for reply
ok but is there some standard name for filemanager in android ? (something like Explorer.exe in windows?)
 
Upvote 0

mirekk36

Member
Licensed User
Longtime User
Big thanks Erel, now there it's code that is working almost good for me

B4X:
    Try   
        Dim i As Intent   
        i.Initialize(i.ACTION_VIEW, "file://" &  File.DirRootExternal&"/myFolder/" )
        i.SetType( "resource/folder" )
        StartActivity(i)
    Catch
        Msgbox("Missing default file explorer", "Error")
    End Try

On older Samsung Galaxy S2 I have always error that there isn't any intent to do that, so I put try catch

BTW on this old samsung is explorer named "MyFiles" in "settings" .... but it didn't start

on newer android phones start some other applications which are registered (maybe) as file explorers
 
Upvote 0
Top