HTMLviewer

SoyEli

Active Member
Licensed User
Longtime User
Hello:

Can anybody help, Thank you

I'm trying to open a text file with HTMViewer ;-)

I have tried this, with no results:

Sub Opentext(FileName As String)
Dim i As Intent
i.Initialize(i.ACTION_VIEW, FileName)
i.SetType("text/plain")
i.WrapAsIntentChooser("Choose HTMViewer")
StartActivity(i)
End Sub

This worked but I dont have horizontal scroll:
myw.LoadUrl("file:///android_asset/help.txt")


Thank you:
 
Last edited:

SoyEli

Active Member
Licensed User
Longtime User
I tried:

Sub Opentext(FileName As String)
Dim i As Intent 'Requires a reference to the Phone library
i.Initialize(i.ACTION_VIEW, FileName)
i.SetType("text/plain")
i.PutExtra("android.intent.extra.TEXT", FileName)
i.WrapAsIntentChooser("Choose HTMViewer")
StartActivity(i)
End Sub

It gives me a choice of
"Androzip Pro" or "File editor" only, they dont work

Thank you for your help :)
 
Upvote 0

SoyEli

Active Member
Licensed User
Longtime User
Hello:

Can anybody help with this:
trying to open a text file with "HTMViewer"
android 2.2: sign0085:
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Try this:
B4X:
Sub Opentext(FileName As String)
Dim i As Intent 'Requires a reference to the Phone library
i.Initialize(i.ACTION_VIEW, "")
i.SetType("text/plain")
i.PutExtra("android.intent.extra.TEXT", File.ReadString(..., ...)) 'CHANGE to path and file name.
i.WrapAsIntentChooser("Choose HTMViewer")
StartActivity(i)
End Sub
 
Upvote 0

SoyEli

Active Member
Licensed User
Longtime User
Hello: Thank you for the help

the file was stored in *File.WriteList(File.DirRootExternal,"AOTCall\CustInfo\"&Txt&".txt",CustomerList)*


Sub Opentext(Dir As String,FileName As String)
Dim i As Intent
i.Initialize(i.ACTION_VIEW, "")
i.SetType("text/plain")
i.PutExtra("android.intent.extra.TEXT", File.ReadString(File.DirRootExternal & "\" & Dir & "\",FileName))
i.WrapAsIntentChooser("Choose HTMViewer")
StartActivity(i)
End Sub

It gives me a choice of "Androz zip,File Editor" only
 
Upvote 0

SoyEli

Active Member
Licensed User
Longtime User
After wks of trying :)

This works good:

Dim Intent1 As Intent
Intent1.Initialize(Intent1.ACTION_VIEW,"file://"& File.DirInternal & "/TextName.txt")
intent1.SetType("text/plain")
StartActivity(Intent1)


:sign0060:
 
Upvote 0
Top