Android Question Why? java.lang.ClassCastException

Lee Gillie CCP

Active Member
Licensed User
Longtime User
Sorry, this makes no sense to me.

My code is:
B4X:
Sub LockoutCheckout( lock As Boolean ) As Boolean
    If lock Then
        If Starter.CheckoutIsLocked Then
            Msgbox("CHECKOUT IS ALREADY RUNNING." & CRLF & CRLF & _
                    "This is a safetey check to protect against" & CRLF & _
                    "double posting of transactions." & CRLF & _
                    "It appears CHECKOUT is ALREADY RUNNING." & CRLF & _
                    "Please give this 30 seconds to complete." & CRLF & CRLF & _
                    "If after 30 seconds you find yourself here again" & CRLF & _
                    "then EXIT the EljayDelivery app" & CRLF & _
                    "(close all windows, or if needed power-off the tablet)" & CRLF & _
                    "then restart the EljayDelivery app" & CRLF & _
                    "and try CHECKOUT again.","CHECKOUT DOUBLE POSTING PROTECTION")
            Return False
        Else
            Starter.CheckoutIsLocked = True
            Return True
        End If
    Else
        Starter.CheckoutIsLocked = False
    End If
    Return False
End Sub

Line 122 is the very LAST "Return False", just before END SUB. The exception I am getting is:


This should be obvious, but not seeing it. Any suggestions would be greatly appreciated.
 

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
Without seeing all the code it is hard to say, but if it were me I would check the line that is invoking this routine and make sure that you are passing in a Boolean variable and not some other type.
 
Upvote 0

Lee Gillie CCP

Active Member
Licensed User
Longtime User
Thank you for giving this a thought Jeffrey. Here are all my references...
B4X:
    If Not(LockoutCheckout(True)) Then
        Activity.Finish
         Return
    End If
....
and 4 more references, all like this:
        LockoutCheckout(False)
 
Upvote 0

Lee Gillie CCP

Active Member
Licensed User
Longtime User
Thanks again Jeffrey. I've never used the PROJECT CLEAN feature. Not sure what it does, but I've read it is only supposed to be before producing a release APK. But anyway, this mystery seems to have resolved with your suggestion.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…