I retrieved the backgroundTransparency of a LWUIT Button , and it returns a byte datatype data. I want this byte variable to be converted to an int variable. How to do that ?
I retrieved the backgroundTransparency of a LWUIT Button , and it returns a byte
Share
Fernando’s answer is 100% correct but is still slightly misleading e.g.:
That might surprise most people at first glance but the logic is actually simple. 0xff is a negative number for a byte but a positive number for an int (this is also true in Java SE). The solution is to change the code from above to something that will convert to int “properly”:
This will solve the issue there but you should still be aware that: