Android Question Fileprovider sub directory

mrossen

Active Member
Licensed User
Longtime User
Hi,

Is it possible to access a subdirectory with the fileprovider class?

Ex. a subdirectory in DirDefaultExternal

Mogens
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

mrossen

Active Member
Licensed User
Longtime User
I have a app that download pdf files to DirDefaultExternal.

I then open them with acrobat reader.

I also have two sub directorys in DirDefaultExternal.

Like:

DirDefaultExternal/user and DirDefaultExternal/inst

I use the fileprovider class to get the directory (DirDefaultExternal) and then open the pdf file with acrobat reader.


B4X:
If File.Exists(Starter.Provider.SharedFolder, sPath) Then
        Dim Intent1 As Intent
                    
            Intent1.Initialize(Intent1.ACTION_VIEW, "")
            Starter.Provider.SetFileUriAsIntentData(Intent1, sPath)
            Intent1.SetComponent("android/com.android.internal.app.ResolverActivity")
            Intent1.SetType("application/pdf")
            
            Try
                StartActivity(Intent1)
            Catch
                MsgboxAsync("No App to display PDF files is installed on your device...." & CRLF & CRLF &  LastException,"Error PDF")
            End Try

            Return
            
    End If

But i like to something like this:

B4X:
pdfDir = "/user"
    
    
    If File.Exists(Starter.Provider.SharedFolder & pdfDir, sPath) Then
        Dim Intent1 As Intent

            Intent1.Initialize(Intent1.ACTION_VIEW, "")
            Starter.Provider.SetFileUriAsIntentData(Intent1, pdfDir & sPath)
            Intent1.SetComponent("android/com.android.internal.app.ResolverActivity")
            Intent1.SetType("application/pdf")
                    
            Try
                StartActivity(Intent1)
            Catch
                MsgboxAsync("No App to display PDF files is installed on your device...." & CRLF & CRLF &  LastException,"Error PDF")
            End Try

            Return
                    
    End If

Mogens
 
Upvote 0
Top