//Calculate the screen size, 4.0 screen above or 4.0 screens below the situation:
1 Private voidInitviewimage () {2ImageView =(ImageView) Findviewbyid (r.id.img);3 String ImageUrl;4 DoubleScreen =Getwith ();5 if(Screen > 4){6IMAGEURL = "Picture Address 1";7}Else{8IMAGEURL = "Picture Address 2";9 }Ten Finalbitmap finalmab; Onefinalmab = Finalbitmap.create ( This); A Finalmab.display (imageview,imageurl); - //finalmab.configloadfailimage (r.drawable.loading); - //finalmab.configloadingimage (r.drawable.loading); the } - - - Private DoubleGetwith () { +Displaymetrics DM =NewDisplaymetrics (); - Getwindowmanager (). Getdefaultdisplay (). Getmetrics (DM); + Doublex = Math.pow (dm.widthpixels/dm.xdpi,2); A Doubley = Math.pow (dm.heightpixels/dm.ydpi,2); at - //screen Size (inch) - DoubleScreeninches = Math.sqrt (x+y); - returnMath.Round (screeninches); -}
Calculate Screen Size