Here you can find the source of scaleToScreen(Activity activity, Bitmap bitmap)
public static Bitmap scaleToScreen(Activity activity, Bitmap bitmap)
//package com.java2s; import android.app.Activity; import android.graphics.Bitmap; import android.util.DisplayMetrics; public class Main { public static Bitmap scaleToScreen(Activity activity, Bitmap bitmap) { DisplayMetrics dm = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(dm); int intScreenWidth = dm.widthPixels; int intScreenHeight = dm.heightPixels; // Log.i(TAG, "screen width: " + intScreenWidth); // Log.i(TAG, "screen height: " + intScreenHeight); return Bitmap.createScaledBitmap(bitmap, intScreenWidth, intScreenHeight, true);/* w w w . ja v a 2s. c o m*/ } }