DisplayMetrics dm = new DisplayMetrics();  

getWindowManager().getDefaultDisplay().getMetrics(dm);  

System.out.println("heigth1 : " + dm.heightPixels);  

System.out.println("width1 : " + dm.widthPixels);  

 

DisplayMetrics dm2 = getResources().getDisplayMetrics();  

System.out.println("heigth2 : " + dm2.heightPixels);  

System.out.println("width2 : " + dm2.widthPixels);    

 

Display display = getWindowManager().getDefaultDisplay();   
System.out.println("width-display :" + display.getWidth());   
System.out.println("heigth-display :" + display.getHeight());