Code example for Activity

Methods: getWindowManager

0
     * @param bitmap 
     * @return 
     */ 
    public static Bitmap reDrawBitMap(Activity context,Bitmap bitmap){ 
    	DisplayMetrics dm = new DisplayMetrics(); 
    	context.getWindowManager().getDefaultDisplay().getMetrics(dm); 
	    int rHeight = dm.heightPixels; 
	    int rWidth = dm.widthPixels; 
		//float rHeight=dm.heightPixels/dm.density+0.5f;  
		//float rWidth=dm.widthPixels/dm.density+0.5f;  
		//int height=bitmap.getScaledHeight(dm);  
		//int width = bitmap.getScaledWidth(dm);  
	    int height=bitmap.getHeight(); 
	    int width = bitmap.getWidth(); 
	    float zoomScale; 
	    /**方式1**/ 
//	    if(rWidth/rHeight>width/height){//以高为准  
//	    	zoomScale=((float) rHeight) / height;  
//	    }else{  
//	    	//if(rWidth/rHeight<width/height)//以宽为准  
//	    	zoomScale=((float) rWidth) / width;