I am trying to get the screen size in an application, but I am getting the error in my title.
Syntax error on token “size”, VariableDeclaratorId expected after this token
Here is my code:
DisplayMap.java
public class DisplayMap extends Activity {
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
}
Could someone please tell me why I’m getting this error? I’ve been researching, but I can’t figure out what it means.
As always, thank you very much!
Define on method and put all code there and call from the onCreate(..) as it is an activity: