Android Question Problems with Functions

brodmuehler

Member
Licensed User
Dear All

I have this function in my code ... which doesn't work. Could perhaps someone tell me why? It creates the following message ..
java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer

Many thanks
René

B4X:
Public Sub GesamtFlugzeit() As Long
   
    Return 2529360000

End Sub
 

brodmuehler

Member
Licensed User
Thanks for your quick responses. I will check again. Did that yesterday almost whole day up to a point where I almost threw my computer out of the window (which was closed btw). Couldn't find anything. But you are right - there must be one.

Thanks again.
Rene
 

AnandGupta

Well-Known Member
Licensed User
Hi Rene,

Did that yesterday almost whole day up to a point where I almost threw my computer out of the window (which was closed btw)
java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
Before you turn to throw the poor computer next time and GOD forbid the window happen to be opened, try to read the error message closely.
"ClassCastException" does signifies what masters already told you. Googling will also help, as B4A is Java based and errors are related to Java.

I do the googling and many times found the hint to the problem, though I do not know Java, I can understand the explanations I find.

Try it. It will save the poor computer which is trying to help you by showing the errors :)

Regards,

Anand
 

brodmuehler

Member
Licensed User
Hi Everyone

thanks for the nice words. Found the mistake and my computer (and windows) are still alive. This thread is closed.

Thanks again.
Best wishes
René
 
Top