Ok, so here's a simple example using the Phone library.
You need to check Phone and JavaObject in the library tab to make it work.
To discover the full name of the PhoneId method, look in the <b4a-installation-folder>\Libraries\Phone.xml
In this case it's anywheresoftware.b4a.phone.Phone.PhoneId
So now, I wonder if we can find a real-world example where the inline code provides something useful which you can't easily get by just using B4A?
Sub Process_Globals
Private nativeMe As JavaObject
End Sub
Sub Globals
Dim ID As PhoneId
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
nativeMe.InitializeContext
End If
Dim strPhoneNumber As String
strPhoneNumber = nativeMe.RunMethod("GetNumber", Array (ID))
Log ("strPhoneNumber=" & strPhoneNumber)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
#If JAVA
public String GetNumber(anywheresoftware.b4a.phone.Phone.PhoneId x) {
return x.GetLine1Number();
}
#End If