Can i get resolution of android phone..?
if yes then how..?
it will really helpful for me..
Thank you..
Most modern Android devices will give you the option to adjust screen resolution in the Display options or Settings. To get there, look for the gear-like icon on the applications menu. It should be labeled as Settings. You can also swipe down and click on the Settings app from the drop-down menu.
1 Go to the Settings menu > Display. 2 Tap on Screen resolution. 3 Select a resolution by sliding the circle. Tap on Apply once you have selected your preferred screen resolution.
If you want the display dimensions in pixels you can use getSize:
Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); int width = size.x; int height = size.y;
This method was introduced in Android API 13, so if you want to get display metrics for previous APIs use:
DisplayMetrics displaymetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); int height = displaymetrics.heightPixels; int wwidth = displaymetrics.widthPixels;
If you're not in an Activity, you can get the default Display via WINDOW_SERVICE
. Also be sure to set your minSdkVersion to at least 4 in AndroidManifest.xml to enable calls to display.getWidth().
WindowManager wm = (WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); int width = display.getWidth(); // deprecated int height = display.getHeight(); // deprecated
Edit: PhoneGap
Use the following to figure out the display size in pixels
function getDeviceDimention() { console.log("Device Dimention using PhoneGap"); console.log("Width = " + window.innerWidth); console.log("Height = " + window.innerHeight); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With