0 Replies Latest reply on Nov 28, 2013 12:53 PM by pcoyne1979

    Finding actual screen height on an Android mobile device

    pcoyne1979

      Hello, I'm using the Flex 3.8 Adobe Air sdk to create a mobile app. The problem I am having is with finding the actual screen height of an Android device. This means the height including the system bar at the bottom which has soft navigation controls that are part of the Android OS. The reason I need to find the height of the device's screen, is that I need to know the screen dimensions in any orientation, before I have reoriented the device. This is because I need to create BitmapData objects of display objects in different orientations.

       

      Finding the height of the available screen space is easy. I can use FlexGlobals.topLevelApplication.height, Capabilities.screenResolutionY, screen.height etc. This works well in iOS, where I can set the app to be full screeen and then the two values for width and height will always be the same in any orientation. With the value for height in portrait becoming the value for width in landscape. The problem in Android is that the values for width/height don't stay the same in different orientations because of the system bar. There seems to be no easy way to find out what the FlexGlobals.topLevelApplication.height of the app will be before reorienting the device.

       

      What I need to do is find out the proper height of the devices screen (in actionscript) then subtract FlexGlobals.topLevelApplication.height from that. This will give me the height of the system bar. Once I have the height of the system bar I can make a simple calculation to find what the FlexGlobals.topLevelApplication.height will be in different orientations, without having to reorient the device first. I hope this makes sense.

       

      So is there any way to find out the full height of an Android mobile devices screen? If not, then is there a way to work out what the system bar's height is? Thanks for your help.