0

I am getting the screen resolutions with the help of the following code snippet.

DisplayMetrics displaymetrics = new DisplayMetrics();
       getActivity().getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
        int height = displaymetrics.heightPixels;
        int width = displaymetrics.widthPixels;
        int totalsize=height*width;

Now I want to classify the screens in hdpi,mdpi,xhdpi,xxhdpi and xxxhdpi through getting resolution.

Since each phone of same screen size has different resolution so can someone tell me which resolution range is for which density ? for example if the resolution is : 1920 x 1080. In which screen density does it classify in?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Kylo Ren
  • 486
  • 6
  • 24
  • Possible duplicate of [How to get screen size of device?](https://stackoverflow.com/questions/6589101/how-to-get-screen-size-of-device) – Ramesh sambu Dec 27 '17 at 11:12
  • yes i got the function from here but i think you did'nt understand what i want to ask. I have the resolution and now i want to know that which resolutions will fall in hdpi category, which one in mdpi etc etc – Kylo Ren Dec 27 '17 at 11:30
  • @NikhilBorad thank you so much for the answer but i cant extend my classes and i am in search of something manual. – Kylo Ren Dec 27 '17 at 11:32

1 Answers1

1

Have a look here, it will help you in understanding more about different screen sizes.

For your problem statement:

xlarge screens are at least 960dp x 720dp

large screens are at least 640dp x 480dp

normal screens are at least 470dp x 320dp

small screens are at least 426dp x 320dp

Hope this helps.

nimi0112
  • 2,065
  • 1
  • 18
  • 32