Breaking News
Loading...

How to Create AVDS with Different Resolutions in Android

6:06 PM


In the AVD manager if you choose a Built-in skin then the Abstracted LCD density is ignored and it will set the density as described here:

Emulator Skins (from http://developer.android.com/tools/revisions/platforms.html)

The downloadable platform includes the following emulator skins:

QVGA (240x320, low density, small screen)
WQVGA400 (240x400, low density, normal screen)
WQVGA432 (240x432, low density, normal screen)
HVGA (320x480, medium density, normal screen)
WVGA800 (480x800, high density, normal screen)
WVGA854 (480x854 high density, normal screen)
WXGA720 (1280x720, extra-high density, normal screen)
WSVGA (1024x600, medium density, large screen)
WXGA800-7in (1280x800, high density, large screen) new
WXGA800 (1280x800, medium density, xlarge screen)
If you wish to set your own Abstracted LCD density you'll need to define your own resolution manually by clicking the Resolution radio button.

Here's some code you can use to test this:

DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int density = metrics.densityDpi;
if (density == DisplayMetrics.DENSITY_HIGH) {
Toast.makeText(this, "DENSITY_HIGH... Density is " + String.valueOf(density), Toast.LENGTH_LONG).show();
}
else if (density == DisplayMetrics.DENSITY_MEDIUM) {
Toast.makeText(this, "DENSITY_MEDIUM... Density is " + String.valueOf(density), Toast.LENGTH_LONG).show();
}
else if (density == DisplayMetrics.DENSITY_LOW) {
Toast.makeText(this, "DENSITY_LOW... Density is " + String.valueOf(density), Toast.LENGTH_LONG).show();
}
else {
Toast.makeText(this, "Density is neither HIGH, MEDIUM OR LOW. Density is " + String.valueOf(density), Toast.LENGTH_LONG).show();
}

0 komentar:

Post a Comment

 
Toggle Footer