EF's Blog

Android Tutorial : Get Screen DPI programmatically

Posted on: April 17, 2012

public static int getMetricDPI(Activity myActivityReference)
{

//created by Erwin Fransiscus
//get display DPI
DisplayMetrics metrics = new DisplayMetrics();
myActivityReference.getWindowManager().getDefaultDisplay().getMetrics(metrics);
return metrics.densityDpi;
}

 

it returns integer

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

EF’s Blog

I'm just ordinary people who lived in an extra-ordinary world.

EF's Blog Stats

  • 126,564 hits
April 2012
M T W T F S S
« Oct   May »
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Archives

%d bloggers like this: