FLIR One Developer / Blog / Topics / v1.3.0 battery lambdas charging state / Battery percentage and charging state callbacks not supporting java lambdas

Battery percentage and charging state callbacks not supporting java lambdas

Home Forums FLIR Mobile SDK Development Android Development Battery percentage and charging state callbacks not supporting java lambdas

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Dani Dani 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)

  • Author

    Posts

  • #14702

    Profile photo of Dani
    Dani

    Participant

    Hi,

    I’m trying to receive percentage and charging state callbacks with the new implementation in v1.3.0 where it seems to have changed to rx since the last version.

    battery.percentage().subscribe(batteryPercentageListener);

    It works without use lambdas, something like this:

    OnReceived<Integer> batteryPercentageListener = new OnReceived<Integer>() {
            @Override
            public void onReceived(Integer integer) {
                customizeBatteryPercentage(integer)
            }
    };

    But if I try to use java lambdas:
    OnReceived<Integer> batteryPercentageListener = (OnReceived<Integer>) integer -> runOnUiThread(() -> customizeBatteryPercentage(integer));

    Will throw this error:
    E/libc++abi: terminating with uncaught exception of type jni::JavaException: java.lang.NoSuchMethodError no non-static method "Lcom/degree2act/degree/view/scan/-$$Lambda$NewSDKScanActivity$fN5oWURRJsbBKe-zySLHPvSkjTo;.onReceived(Lcom/flir/thermalsdk/live/remote/Battery$ChargingState;)V"

    This had already happened in the callback of the withImage function of the Camera class.

    Dani

    #14734

    Profile photo of Gavin
    Gavin

    Keymaster

    Hi Dani,

    Could you please report this error here? You will then be in contact with our technical support team who can give you the best assistance.

    Thank you,
    Gavin
    FLIR Community Support

    #14754

    Profile photo of Dani
    Dani

    Participant

    Hi,

    I submitted as a technical support question, but then, what is the purpose of this forum if later we have to repeat the work by writing to technical support?

    Dani

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.