density = getResources().getDisplayMetrics().density;
// return 0.75 if it's LDPI
// return 1.0 if it's MDPI
// return 1.5 if it's HDPI
// return 2.0 if it's XHDPI
// return 3.0 if it's XXHDPI
// return 4.0 if it's XXXHDPI
More Related Contents:
- Android screen size HDPI, LDPI, MDPI [duplicate]
- How to support different screen size in android
- Application Skeleton to support multiple screens
- android: broadcast receiver for screen on and screen off
- Force “portrait” orientation mode
- How to get screen dimensions as pixels in Android
- How to determine device screen size category (small, normal, large, xlarge) using code?
- Screen orientation lock
- Detecting when screen is locked
- ImageView be a square with dynamic width?
- Prevent screen rotation on Android
- How to display Activity when the screen is locked?
- Developing a custom lock screen [duplicate]
- Turning on screen programmatically
- Android accelerometer not working when screen is turned off
- Android: how to convert whole ImageView to Bitmap?
- How can I get the size of a folder on SD card in Android?
- Android – How to display a dialog over a native screen?
- Detect 7 inch and 10 inch tablet programmatically
- How to avoid restarting activity when orientation changes on Android
- How to get total RAM size of a device?
- How to find android TextView number of characters per line?
- android: turn off screen when close to face
- Creating multi-screen support app android
- What is the difference between getWidth/Height() and getMeasuredWidth/Height() in Android SDK?
- Light up screen when notification received android
- Turn off screen programmatically when face is close the screen on Android
- Correct method for setKeepScreenOn / FLAG_KEEP_SCREEN_ON
- android unlock screen intent?
- Splash screen while loading a url in a webview in android app