I have tested this code from @Erel in a smal project for CSV-files. Everything worked as it should.
But what about txt-files?....
I have tried this code, but get a lot of errors...
But what about txt-files?....
B4X:
#PlistExtra:<key>CFBundleDocumentTypes</key>
#PlistExtra:<array>
#PlistExtra: <dict>
#PlistExtra: <key>CFBundleTypeName</key>
#PlistExtra: <string>[B]CSV File[/B]</string>
#PlistExtra: <key>LSHandlerRank</key>
#PlistExtra: <string>Alternate</string>
#PlistExtra: <key>LSItemContentTypes</key>
#PlistExtra: <array>
#PlistExtra: <string>[B]public.comma-separated-values-text[/B]</string>
#PlistExtra: </array>
#PlistExtra: </dict>
#PlistExtra:</array>
B4X:
Private Sub Application_OpenUrl (Url As String, Data As Object) As Boolean
If Url.StartsWith("file://") Then
Dim f As String = Url.SubString(7) 'remove the file:// scheme.
Try
Msgbox(File.ReadString("", f), "")
Catch
Msgbox("Error loading file", "")
End Try
End If
Return True
End Sub
I have tried this code, but get a lot of errors...
B4X:
#PlistExtra:<key>CFBundleDocumentTypes</key>
#PlistExtra:<array>
#PlistExtra: <dict>
#PlistExtra: <key>CFBundleTypeName</key>
#PlistExtra: <string>[B]Text File[/B]</string>
#PlistExtra: <key>LSHandlerRank</key>
#PlistExtra: <string>Alternate</string>
#PlistExtra: <key>LSItemContentTypes</key>
#PlistExtra: <array>
#PlistExtra: <string>[B]public.txt[/B]</string>
#PlistExtra: </array>
#PlistExtra: </dict>
#PlistExtra:</array>