Android Multiple Devices and Resolutions
Posted: Tue Jan 07, 2014 7:46 pm
I am porting an iOS app to Android. My app handles all iOS devices by detecting screen resolution at launch and then calling an appropriate sub-stack. I'm looking to do this for Android and 7 or 8 of the most popular devices. The dictionary says mobilePixelDensity should provide "Display Metrics" for Android, and a "2" or '1" on iOS. When I use this I am not getting "Metrics", but rather a "2", which is what I would expect on a Retina device. I presume this means the display (Galaxy Nexus emulator) is xhdpi. When I get the screenRect at launch, it reports 360X640. That device should be 720X1280. So if I factor in the mobilePixelDensity, then it makes sense. So I think I can rather easily figure out the proper resolution with this methodology.
I have two questions:
1. Has anyone found a better way to accomplish what I am attempting on Android? (I am not able to leverage res independence, so please no such suggestions).
2. Anyone have experience with mobilePixelDensity on Android? It does not appear, based on documentation, that it is delivering what it should. Or is it?
Comments and suggestions appreciated.
I have two questions:
1. Has anyone found a better way to accomplish what I am attempting on Android? (I am not able to leverage res independence, so please no such suggestions).
2. Anyone have experience with mobilePixelDensity on Android? It does not appear, based on documentation, that it is delivering what it should. Or is it?
Comments and suggestions appreciated.