Hi all,
I'm building an android tablet app that lists song charts. Each chart is one of the following file types: .PDF, .DOC, or .DOCX.
All the files have been manually downloaded to the tablet from a DropBox, maintained by someone else.
The tablet download folder is under the Documents folder as: Charts\Gospel Jam
I'm able to list al the files into a ListView with no problem. This is done an a different page than the Main Page - ImportFiles.
The ImportFiles page has a button that reads the ListView (with the downloaded filenames) and adds the Filename to a SQLITE db.
From the Main Page, a ListView is populated from the SQLITE db. There the user can touch on a row and open the song chart to view for playing their instrument.
I'm having troubles with opening the selected file!
I've used this code to try and open the file, but have not been able to get it to work.
I need to open any one of the file types mentioned above and display it with the Intent object.
What am I missing in my code?
Regards,
Mark Stuart
I'm building an android tablet app that lists song charts. Each chart is one of the following file types: .PDF, .DOC, or .DOCX.
All the files have been manually downloaded to the tablet from a DropBox, maintained by someone else.
The tablet download folder is under the Documents folder as: Charts\Gospel Jam
I'm able to list al the files into a ListView with no problem. This is done an a different page than the Main Page - ImportFiles.
The ImportFiles page has a button that reads the ListView (with the downloaded filenames) and adds the Filename to a SQLITE db.
From the Main Page, a ListView is populated from the SQLITE db. There the user can touch on a row and open the song chart to view for playing their instrument.
I'm having troubles with opening the selected file!
I've used this code to try and open the file, but have not been able to get it to work.
B4X:
Private Sub lvSongs_ItemClick(Position As Int, Value As Object)
Dim lvd As lvData
lvd.Initialize
lvd = Value
If Value <> "" Then
Dim title As String = lvd.Ttl
Log(title)
Dim in As Intent
in.Initialize(in.ACTION_VIEW,"")
Dim tURI As String = Provider.GetFileUri(title)
Log(tURI)
Provider.SetFileUriAsIntentData(in,title) 'Provider has been defined in the Process_Globals
'Provider.SharedFolder = tURI
'in.SetComponent("android/com.android.internal.app.ResolverActivity")
in.SetType("application/pdf")
StartActivity(in)
End If
End Sub
I need to open any one of the file types mentioned above and display it with the Intent object.
What am I missing in my code?
Regards,
Mark Stuart