forum

Home / DeveloperSection / Forums / How to get screen dimensions in pixels

How to get screen dimensions in pixels

Samuel Fernandes 1750 23-Apr-2015
I created some custom elements, and I want to programmatically place them to the upper right corner (n pixels from the top edge and m pixels from the right edge). Therefore I need to get the screen width and screen height and then set position:

int px = screenWidth - m;
int py = screenHeight - n;
How do I get screenWidth and screenHeight in the main Activity?

Updated on 23-Apr-2015

Can you answer this question?


Answer

1 Answers

Liked By