Sub activity_KeyPress (KeyCode As Int) As Boolean
Select keycode
Case KeyCodes.KEYCODE_BACK:
page_back
Return True
End Select
End Sub
Sub page_back
webview1.Back
End Sub
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim WebView1 As WebView
Dim Button1 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("i")
WebView1.LoadHtml("<html><body>Hello world!</body></html>")
WebView1.Visible = False
button1.text="Google"
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub WebView1_PageFinished (Url As String)
End Sub
Sub WebView1_OverrideUrl (Url As String) As Boolean
End Sub
Sub WebView1_UserAndPasswordRequired (Host As String, Realm As String) As String()
End Sub
Sub Button1_down
If WebView1.Url = "http://www.google.com/" Then
WebView1.Visible = False
Button1.text = "Google"
WebView1.LoadUrl("about:page")
Else
WebView1.Visible = True
Button1.text = "Back"
WebView1.LoadUrl("http://www.google.com")
End If
End Sub
Sub Button1_Click
End Sub
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim wvWeb1_URL, wvWeb2_URL As String
Dim btnButton1, btnButton2 As Button
Dim wvWeb1, wvWeb2 As WebView
End Sub
Sub Activity_Create(FirstTime As Boolean)
btnButton1.Initialize("btnButton1")
Activity.AddView (btnButton1, 0,0, 45%x, 50)
btnButton1.Text="WebView1"
btnButton2.Initialize("btnButton2")
Activity.AddView (btnButton2, 55%x,0, 45%x, 50)
btnButton2.Text="WebView2"
wvWeb1.Initialize("wvWeb1")
Activity.AddView(wvWeb1, 0, 55, 100%x, 90%y - 55)
wvWeb1.Visible=False
wvWeb2.Initialize("wvWeb2")
Activity.AddView(wvWeb2, 0, 55, 100%x, 90%y - 55)
wvWeb2.Visible=False
wvWeb1_URL="http://www.b4x.com"
wvWeb2_URL="http://www.greekfunzone.com"
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then
' Msgbox("wv1_url=" & wvWeb1_URL & CRLF & "url=" & wvWeb1.Url , "wv2_url=" & wvWeb2_URL & " - " & "url=" & wvWeb2.Url )
If wvWeb1.Visible =True Then
If wvWeb1.Url=wvWeb1_URL OR wvWeb1.Url=wvWeb1_URL & "/" Then
wvWeb1.Visible=False
Else
wvWeb1.Back
End If
Return True
Else
If wvWeb2.Visible =True Then
If wvWeb2.Url=wvWeb2_URL OR wvWeb2.Url=wvWeb2_URL & "/" Then
wvWeb2.Visible=False
Else
wvWeb2.Back
End If
Return True
End If
End If
End If
End Sub
Sub btnButton1_Click
wvWeb2.Visible=False
wvWeb1.LoadUrl(wvWeb1_URL)
wvWeb1.Visible=True
End Sub
Sub btnButton2_Click
wvWeb1.Visible=False
wvWeb2.LoadUrl(wvWeb2_URL)
wvWeb2.Visible=True
End Sub
My problem Is now that i want To go back To the opening screen with the back Button. Is there a way To go back from the webviews To the start screen with the back Button?
Thanks!
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim TimePushed As Long
Dim BackPushedAlready As Boolean
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If keycode = KeyCodes.KEYCODE_BACK Then
If BackPushedAlready = True Then
If DateTime.Now - TimePushed <= 1000 Then
Return False
Else
BackPushedAlready = False
Page_Back
Return True
End If
End If
If BackPushedAlready = False Then
BackPushedAlready = True
TimePushed = DateTime.Now
Page_Back
Return True
End If
End If
End Sub
Sub Page_Back
webview1.Back
End Sub
Sub page_back
If webview1.Url = ("URL1") OR _
webview1.Url = ("URL2") Then
Activity.Finish
Else
webview1.Back
End If
End Sub
dim mynum as int
mynum = 2
if mynum = null then
mynum=0 'or muynum = (whatever it is supposed to hold) so it isnt empty
'CODE FOR BACK BUTTON COPIED HERE
else
'CODE FOR BACK BUTTON COPIED HERE
end if
Mynum=0
Sub Globals
Dim wv As WebView
End Sub
Sub Activity_Create(FirstTime As Boolean)
wv.Initialize("wv")
Activity.AddView(wv, 0, 0, 300dip, 300dip)
wv.LoadUrl("http://www.google.com")
End Sub
Sub wv_PageFinished (Url As String)
Msgbox("Page " & url & " is ready.", "")
End Sub
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?