java - how to find the ppi of an android screen -


i have simple question? i'm looking code find ppi of android screen know how find height , width in pixles not amount of pixels per inch. need me find diagonal of screen. tried doesnt seem work

        displaymetrics displaymetrics = new displaymetrics();         windowmanager wm = (windowmanager) getapplicationcontext().getsystemservice(context.window_service);         int  ppi = (int) displaymetrics.density; 

maybe this?

   displaymetrics metrics = getresources().getdisplaymetrics(); 

see here


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -