Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Point getRealScreenSize(Context context) {
- WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
- Display display = windowManager.getDefaultDisplay();
- Point size = new Point();
- if (Build.VERSION.SDK_INT >= 17) {
- display.getRealSize(size);
- } else {
- try {
- size.x = (Integer) Display.class.getMethod("getRawWidth").invoke(display);
- size.y = (Integer) Display.class.getMethod("getRawHeight").invoke(display);
- } catch (Exception ignored) {}
- }
- return size;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement