#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
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.
Private WebView1 As WebView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
Dim Native As JavaObject = Me
Log("B4A: Calling Initialize with BA and WebView")
Native.RunMethod("Initialize", Array(Me, WebView1)) ' Me = reference to the activity BA object
Log("B4A: Call to InitializeJava finished.")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
#if JAVA
import anywheresoftware.b4a.BA;
import android.webkit.WebView;
private static BA parent;
private static WebView webView;
public void Initialize(BA ba, WebView wv) {
parent = ba;
webView = wv;
BA.Log("✅ Java Initialize called. BA = " + parent);
}
#End If