Android Question open HTML file in the default Android viewer

sirjo66

Well-Known Member
Licensed User
Longtime User
Hello,

I have a file .html that I want to view with default html viewer.

I use this code but it don't works:
B4X:
    Dim ii As Intent
    ii.Initialize(ii.ACTION_VIEW, "file://" & File.Combine(File.DirDefaultExternal, "guia.htm"))
    ii.SetType("text/html")
    StartActivity(ii)

Android ask to me for to select the program that I want to use, but there are only "DB editor" and "HTMLViewer" but don't open default viewer.

Do I need to use Intent.SetComponent ??

Sergio
 
Last edited:

Mark Read

Well-Known Member
Licensed User
Longtime User
What about using the default editor?

B4X:
Dim ii AsIntent
 ii.Initialize(ii.ACTION_EDIT, "file://" & File.Combine(File.DirDefaultExternal, "guia.htm"))
 ii.SetType("text/html")
StartActivity(ii)
 
Upvote 0

sirjo66

Well-Known Member
Licensed User
Longtime User
SOLVED !!
B4X:
    Dim ii As Intent
    ii.Initialize(ii.ACTION_VIEW, "file://" & File.Combine(File.DirDefaultExternal, "guia.htm"))
    ii.SetType("application/x-webarchive-xml")
    StartActivity(ii)
 
Upvote 0
Top