ItsJustme ItsJustme - 1 year ago 285
Android Question

If, else if statement not working in Android studio

maybe it is something very small that I am missing but somehow my if statement doesn't work. I want to check if the x of the position of a picture if greater than the screen width but somehow i get the errors:

"else without if" and ")" or "; expected"

Here is my code:

if (image.getX() => screenWidth){
image.animate().xBy(- (screenWidth + 120));
} else if (image.getX() <= -120){

Answer Source

=> is not a valid oeprator in Java, you re looking for >= (greater than or equal to)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download