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?
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.