[android] get real screen size

@SuppressLint("NewApi")
public static Point screenSize(Context $context)
{
  Point result = new Point();
  WindowManager manager = (WindowManager) $context.getSystemService(Context.WINDOW_SERVICE);
  Display display = manager.getDefaultDisplay();
  
  if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1)
    display.getRealSize(result);
  else
    display.getSize(result);
  
  return result;
}

 

 

Point size = Util.screenSize(getApplicationContext());
// width : size.x
// height : size.y