My android app supports all screen sizes, but sometimes I need to dynamically load resources from my server, how can I determine (programmatic) which resource to load ?
My android app supports all screen sizes, but sometimes I need to dynamically load
Share
You can use the DisplayMetrics class to get the screen density and screen width/height in a variety of formats.
You can get the DisplayMetrics by calling
getWindowManager().getDefaultDisplay().getMetrics(metrics);Just throw that into a switch statement, or cleverly format your resource URLs and requests to make use of the densities.