0

I would like get the current size screen inch at the Android to choose a image appropriate for each screen, because my imageview current is larger at the some screens! Is there something method to get it?

Leonardo Costa
  • 994
  • 11
  • 26

2 Answers2

1

Take a look at this :

Is there a way to determine android physical screen height in cm or inches?

    DisplayMetrics dm = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(dm);
    double x = Math.pow(dm.widthPixels/dm.xdpi,2);
    double y = Math.pow(dm.heightPixels/dm.ydpi,2);
    double screenInches = Math.sqrt(x+y);
    Log.d("debug","Screen inches : " + screenInches);
Community
  • 1
  • 1
Mehdi Karamosly
  • 5,388
  • 2
  • 32
  • 50
  • 3
    Rather than copying an existing answer, the question should have been flagged as a duplicate –  Nov 12 '13 at 19:36
0

I recommend reading the documentation of Android

http://developer.android.com/guide/practices/screens_support.html

Clebao
  • 167
  • 3
  • 10