I'm trying to use the Android Documentation in conjunction with the Java Language object to get the value of some properties.
This is the code that I am trying
The first part worked Ok and the jo2 object was initialised.
However I get this error when I try to get the ASU info:
Where am I going wrong with this? If I can sort this out I'll be well on my way to being able to make better use of the Android Documentation and Methods,
CellSignalStrength
extends Object
java.lang.Object
↳android.telephony.CellSignalStrength
Abstract base class for cell phone signal strength related information.
...
Public Methods
abstract booleanequals(Object o)
Compares this instance with the specified object and indicates if they are equal.
abstract intgetAsuLevel()
Get the signal level as an asu value between 0..31, 99 is unknown
This is the code that I am trying
B4X:
Dim jo,jo2 As JavaObject
Dim ASU As String
Try
jo2 = jo.InitializeStatic("android.telephony.CellSignalStrength")
log("Got Signal Strength object OK")
ASU=jo2.RunMethod("getAsuLevel", Null)
Log("ASU= " & ASU)
Catch
Log("Java Error: " & LastException.Message)
End Try
The first part worked Ok and the jo2 object was initialised.
However I get this error when I try to get the ASU info:
Java Error: java.lang.IllegalArgumentException: Expected receiver of type android.telephony.CellSignalStrength, but got java.lang.Class<android.telephony.CellSignalStrength>
Where am I going wrong with this? If I can sort this out I'll be well on my way to being able to make better use of the Android Documentation and Methods,