views:

40

answers:

1

I am trying to simply test my app under a QVGA setting, but 95% of the time when I run the QVGA emulator I created, it loads the resources associated with HVGA. I have custom bitmaps that I include in my app, so it's crucial for me to be able to verify the appearance.

To see what the density was being treated as, I added the following code and displayed the results in a Toast:

DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);

// will either be DENSITY_LOW, DENSITY_MEDIUM or DENSITY_HIGH
int dpiClassification = dm.densityDpi;

// these will return the actual dpi horizontally and vertically
float xDpi = dm.xdpi;
float yDpi = dm.ydpi;

Output was -> DensityClass = 160 - xDpi = 164.75 - yDpi = 165.88

Perhaps I am simply misunderstanding, but for starters, shouldn't the density class have a value of 120?

I created a QVGA emulator in the AVD manager with the following settings:

Target: 1.6 level 4
Hardware Property: Abstracted LCD Density = 120 (verified in config.ini file)

In my Manifest file, I added the following:

<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true"/>

In my res folder, I have:

drawable
drawable-hdpi
drawable-ldpi
drawable-mdpi

Can someone tell me why the emulator is not loading the low density drawables? The drawables in this QVGA emulator are the same exact size as the drawables in the HVGA emulator (not what I want), and yes, I scaled down the pictures before adding them to the LDPI folder (drastically smaller). For no apparent reason, once in a while the emulator will actually load properly and everything displays correctly, but again, this only happens about 5% of the time with no apparent reason for why.

A: 

I have been struggling with my app returning medium density regardless of what type of emulator I used for a while now. Once I found that support-screens/anyDensity statement, that fixed my problem. I noticed the documentation was wrong saying after level 4, you did not need that statement in your manifest file. However, I am using 2.2 so it was wrong.

All in all it could be related to your issue.

What I really wanted to point out though was this webpage. Don't waste too much time on QVGA, your time is much better spent elsewhere as you can see.