I have a simple App that uses 'webview' and 4 buttons.
The following is the onload code.
B4X:
Sub Activity_Create(FirstTime As Boolean)
WebView1.Initialize("brass_band_Click")
Activity.LoadLayout("brass_band")
WebView1.LoadURL("http://www.rushdenwindmillband.com/Apps/master.php")
End Sub
When i press a button it shows a website like the following..
B4X:
Sub btnDown1_Click
WebView1.LoadURL("http://www.4barsrest.com")
Dim WebViewSettings1 As WebViewSettings
WebViewSettings1.setDefaultZoom(WebView1, "FAR")
WebViewSettings1.setLoadWithOverviewMode(WebView1, True)
WebViewSettings1.setUseWideViewPort(WebView1, True)
End Sub
Pressing the buttons to reveal a website works fine but when i rotate the phone/tablet to Landscape it seems to retrigger the onload event and load the first webiste??
This prevents your code running after an orientation change ..
B4X:
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
WebView1.Initialize("brass_band_Click")
Activity.LoadLayout("brass_band")
WebView1.LoadURL("http://www.rushdenwindmillband.com/Apps/master.php")
end if
End Sub
This sub is called when the activity is created.
The activity is created when the user first launches the application, the device configuration has changed (user rotated the device) and ...