android dpi DisplayMetrics

http://www.cnblogs.com/wader2011/archive/2011/11/28/2266669.html
  DisplayMetrics dm = new DisplayMetrics();
  activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
D:\linux\linuxkernel\WORKING_DIRECTORY\android-omap-20111108-gingerbread\frameworks\base\core\java\android\view\Display.java
        outMetrics.densityDpi   = (int)((mDensity*DisplayMetrics.DENSITY_DEFAULT)+.5f);
D:\linux\linuxkernel\WORKING_DIRECTORY\android-omap-20111108-gingerbread\frameworks\base\core\java\android\util\DisplayMetrics.java
    /**
     * Standard quantized DPI for medium-density screens.
     */
    public static final int DENSITY_MEDIUM = 160;
    /**
     * The reference density used throughout the system.
     */
    public static final int DENSITY_DEFAULT = DENSITY_MEDIUM;
D:\linux\linuxkernel\WORKING_DIRECTORY\android-omap-20111108-gingerbread\frameworks\base\core\jni\android_view_Display.cpp
    offsets.density     = env->GetFieldID(clazz, "mDensity", "F");
    status_t err = SurfaceComposerClient::getDisplayInfo(DisplayID(dpy), &info);
    env->SetFloatField(clazz, offsets.density,  info.density);
http://www.netmite.com/android/mydroid/frameworks/base/libs/ui/SurfaceComposerClient.cpp
    volatile surface_flinger_cblk_t const * cblk = get_cblk();
    volatile display_cblk_t const * dcblk = cblk->displays + dpy;
    info->density        = dcblk->density;
http://blog.csdn.net/winson_jason/article/details/8262898
DPI对应于DisplayMetrics类中属性densityDpi的值
$CC -o libdpi.so -g -fPIC -shared dpi.cpp -I/media/linux/1/android-20120605-2.3.4_r1/frameworks/base/include -I/media/linux/1/android-20120605-2.3.4_r1/system/core/include -I/media/linux/1/android-20120605-2.3.4_r1/hardware/libhardware/include

你可能感兴趣的:(android dpi DisplayMetrics)