I have made a test app to view a pdf file in acrobat. For some reason I haven't gotten the path correct and I am missing something. I'm sure it is something stupid too. It usually is. Any help would be appreciated. I have posted the code and the app file.
Thanks.
Thanks.
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private btnSearch As Button
Private btnView As Button
Private testview As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Main")
'create the directory
File.MakeDir(File.DirRootExternal, "TestPDF")
'copy the file
If File.Exists(File.DirRootExternal & "/TestPDF", "Invoice# 57235.pdf") = False Then
File.Copy(File.DirAssets, "Invoice# 57235.pdf", File.DirRootExternal & "/TestPDF", "Invoice# 57235.pdf")
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btnSearch_Click
testview = ""
Dim filefrom As FileDialog
filefrom.FilePath=File.DirRootExternal & "/TestPDF"
filefrom.Show("List Of Files", "", "OK", "", Null)
testview = filefrom.ChosenName
End Sub
Sub btnView_Click
Dim Intent1 As Intent
Intent1.Initialize(Intent1.ACTION_VIEW, "file://" & File.Combine(File.DirRootExternal & "/TestPDF/", testview))
Intent1.SetComponent("android/com.android.internal.app.ResolverActivity")
Intent1.SetType("application/pdf")
StartActivity(Intent1)
End Sub