I’ve started doing some tests with the 2D API of Android, and to start with something simple, I have an animated sprite walking on platforms at different heights.
To avoid unnecessary complications, I just added the images in the folder drawable-mdpi (which corresponds to my device).
To make sure that the sprite has its feet on the platforms, I coded in the program a coordinate in pixels corresponding to the average position of the feet of the sprite images.
Android does not require you to include images for all possible densities, an image for one density is enough, but when you use the application on a device with a different density, Android automatically scales the image to fit the target density. And if you provide different image sizes for different densities, the problem is the same, your pixel coordinates will only fit one density.
This means that math in a game should not use absolute pixel measures, because the results will be incorrect. Android adapts its own calculations when you use images in layouts, but does little for a game developer that draw on the canvas freely.
I code normalized coordinates in sprite space. This is slower, as implies floating point multiplications to get the final pixel integer values, but I don’t know a better solution to this problem (if you know it, you are welcome to share).