Android Question (solved) Main activity with local webpage does StartActivity2?

anOparator

Active Member
Licensed User
Longtime User
A webView is in Main activity with a local webpage, I am trying to do 'StartActivity2' from the webView in Main.

B4X:
Sub Globals
    Private wvTur As WebView
End Sub

B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("webpage1")

'    This does create and load a WebView (Main) Activity.
    wvTur.LoadHtml("<html><body><h3>" & NameBar & "</h3><p>Address:<br/><strong>" & AddressBar & "</strong></p> " & "<p>Telephone:<br/><strong>5555-7777</strong></p>"& "<FORM action='openActivity'><INPUT type='submit' value='Show Activity'></FORM>"&"</body></html>")

'    This does not load a LOCAL web page into a WebView (Main) Activity.    <<<
'    Only the FORM appears in the Main Activity.
    wvTur.LoadHtml("existingWebPage.htm" & "<FORM action='openActivity'><INPUT type='submit' value='Show Activity'></FORM>")
    wvTur.ZoomEnabled = False
End Sub

B4X:
Sub wvtur_OverrideUrl(Url As String) As Boolean
'    How to use this with a local webpage in a WebView (Main) Activity?
          StartActivity(Activity2)    
    Return True
End Sub
How to go from a local webpage in a WebView (Main) Activity, to Activity2?
 

anOparator

Active Member
Licensed User
Longtime User
Activity2 still not opening.
The webpage is in the Assets folder.
B4X:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
p.sansserif{font-family:"Arial",  sans-serif;font-size:150%;}
#div1 [font-stretch:condensed;]
#div2 [font-stretch:expanded;]
</style>
</head>
<body><p class="sansserif"> This cell phone program lets you share Inspirational Messages and personal thoughts. <br>

' I changed THIS:    <FORM action='openActivity'><INPUT type=  'submit' value= 'eMail Us'</FORM>
To THIS:        <FORM action='<a href=“Activity2”>Go to Activity 2</a>'><INPUT type=  'submit' value= 'eMail Us'</FORM>
</body>
</html>
 
Upvote 0

anOparator

Active Member
Licensed User
Longtime User
Now this works very good, thank you.
Line 13:
<a href=“Activity2”><FORM action='openActivity'><INPUT type= 'submit' value= 'eMail Us'</FORM></a>
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
HTML:
<body>
    <p class="sansserif"> This cell phone program lets you share Inspirational Messages and personal thoughts. <br />
    <a href="Activity2">eMail Us</a></p>
</body>

B4X:
Sub wvtur_OverrideUrl(Url As String) As Boolean
    If Url = "Activity2" Then
        StartActivity(Activity2)
        Return True
    Else
        Return False
    End If
End Sub
 
Upvote 0

anOparator

Active Member
Licensed User
Longtime User
Ok, will do this in the morning and study the HTML/B4A combination .
Thanks again.
 
Upvote 0
Top