Android Question JavaObject

Angelo Messina

Active Member
Licensed User
Longtime User
#AdditionalJar:irlib-release.aar
...


Hi from a third-party library I have to read data from a device.
this is the code

Dim battery, memtot, memused, nfile As Int
Dim sn, version As String
Dim temperature As Float

Dim ctxt As JavaObject
ctxt.InitializeContext
Dim handler As JavaObject
handler.InitializeNewInstance("android.os.Handler", Null)
irh.InitializeNewInstance("com.rft.irlib.IrHandler", Array(ctxt, handler))

battery = irh.RunMethod("GetBattery", Null)
Log("Battery: " & battery)

memtot = irh.RunMethod("GetMemTot", Null)
Log("MemTot: " & memtot)

memused = irh.RunMethod("GetMemUsed", Null)
Log("MemUsed: " & memused)

nfile = irh.RunMethod("GetNFile", Null)
Log("NFile: " & nfile)

sn = irh.RunMethod("GetSN", Null)
Log("SN: " & sn)

version = irh.RunMethod("GetVersion", Null)
txtVersione.Text=version
Log("Version: " & version)

temperature = irh.RunMethod("GetTemperature", Null)
Log("Temperature: " & temperature)


int GetBattery()
int GetMemTot()
int GetMemUsed()
int GetNFile()
java.lang.String GetSN()
float GetTemperature()
java.lang.String GetVersion()

No result
Thank you
 

DonManfred

Expert
Licensed User
Longtime User
1. Please use Code tags when posting code!
2. What is the question?
3. Do not expect that WE know the lib you are using resp. their Documentation.
 
Upvote 0

Angelo Messina

Active Member
Licensed User
Longtime User
public class IrHandler
extends java.lang.Object
DEPENDING on BUILD option, following PROGUARD rules could be NECESSARY
-keepclassmembers class com.rft.irlib.* {
*;
}
 
Upvote 0

Angelo Messina

Active Member
Licensed User
Longtime User
#AdditionalJar:irlib-release.aar

B4X:
    Dim ctxt As JavaObject
    ctxt.InitializeContext
    Dim handler As JavaObject
    handler.InitializeNewInstance("android.os.Handler",   Null)
    irh.InitializeNewInstance("com.rft.irlib.IrHandler", Array(ctxt, handler))

    sn = irh.RunMethod("GetSN", Null)
    Log("SN: " & sn)

public java.lang.String GetSN()
Returns:
Serial number of Smart RFT
 
Upvote 0
Top