I have been having trouble getting the screen dimensions for android. I do not want the size of the status bars included in my dimenions. The app that I’m developing is to be permanently in landscape mode. I have been testing with the android honeycomb emulator. When I get the dimensions using the code in How can I get android Honeycomb system's screen width and height? I get 1280×800. I was curious as to why the person in the linked question has the size of the status bars subtracted while mine does not work that way. Also, how can I make it so that the size of the status bars is actually subtracted? If any additional details are needed I will be checking periodically to provide. Thanks!
Share
Okay! I finally figured it out. I pieced together code from several different sources so I don’t know exactly why things work out the way they do. Here is the relevant code.
There is one caveat though. This code WILL NOT work in the onCreate() method. Instead, place it in
This should solve any problems with getting window dimensions!
EDIT: I believe this solution should also work in portrait mode as well. I have not tested it though.