Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emulating density of 320 dpi on android emulator

Tags:

We're trying to emulate devices with the new density of 320 dpi in Android 2.3 - such as Archos 101, and we can't seem to be able to define an emulator with such density, even after downloading the latest 2.3 sdk.

I would really appreciate some ideas on this one :)

Many thanks!

like image 784
LB_ Avatar asked Jan 25 '11 09:01

LB_


People also ask

How do I change dpi in emulator?

If you are using Eclipse go to Window - Android SDK and AVD Manager , there hit the New button, enter a name and select the SDK version, hit the Resolution option down in the Skin section and set the resolution you need.

How can I get density in Android?

You can get info on the display from the DisplayMetrics struct: DisplayMetrics metrics = getResources(). getDisplayMetrics(); Though Android doesn't use a direct pixel mapping, it uses a handful of quantized Density Independent Pixel values then scales to the actual screen size.

What is the best dpi for Android?

Here's what we recommend: 3GB RAM: 410 DPI. 4GB RAM and above: 480 DPI.

Why is it problematic to define Sizesusing pixels on Android?

The first pitfall you must avoid is using pixels to define distances or sizes. Defining dimensions with pixels is a problem because different screens have different pixel densities, so the same number of pixels may correspond to different physical sizes on different devices.


1 Answers

That is quite simple.

Modify the attribute hw.lcd.density=320 at avd config file: /Users/yourUserName/.android/avd/CustomDevice_API_19.avd/config.ini, and reboot your virtual device. I'm already test it, and it works to me!

Warnning: Make sure you set the correct density, otherwise you will receive an error: qemu: available lcd densities are: 120, 160, 213, 240, 280, 320, 360, 400, 420, 480, 560, 640

BTW my Android SDK Tools version is 25.2.5.

like image 93
codezjx Avatar answered Sep 21 '22 04:09

codezjx