I’m building a small app that is using a surfaceview class that extends surfaceholder.callback. It is implemented just like the lunarlander example. My problem is that each type of emulator I use (low, medium or high density) doesn’t seem to actually change the density of the screen or the resolution to what I would expect. I recently asked this question on stack overflow and it is dawning on me that I’m not doing anything wrong with that function, the problem is that somehow any emulators I use are all getting recognized at medium density.
The high density emulator screen shows very pixilated images. The medium density emulator images look fantastic. The low density emulator images look pixilated, but not as bad as the hdpi.
I did a mySurfaceHolder.getSurfaceFrame() on each emulator and came up with this:
- WVGA800 - 480x800 - hdpi - generates a surface 320 x 508
- Default(HVGA) - mdpi - generates a surface 320 x 455
- QVGA - 240x320 - ldpi - generates a surface 320 x 402
Shouldn’t these surfaces be 480x800, 320x480 and 240x320 respectively? Edit: the 320x455 makes sense, the rest is probably taken up in the title bar. But what about the low/high?
So, I’m unsure if my problem is:
How I’m setting up the emulator. – I use HVGA, QVGA, WVGA800, and WVGA854 with standard settings (no custom resolutions)
Something wrong with my code in the surfaceview class. Note than I do not manually set a size, I rely on the size returned from this callback method:
.
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
thread.setSurfaceSize(width, height);
}
Any thoughts? As always, I appreciate all your help!