Android Bitmap Scale scaleToScreen(Activity activity, Bitmap bitmap)

Here you can find the source of scaleToScreen(Activity activity, Bitmap bitmap)

Description

scale To Screen

Declaration

public static Bitmap scaleToScreen(Activity activity, Bitmap bitmap) 

Method Source Code

//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*/
    }
}

Related

  1. scaleBitmap(Bitmap bitmap, int dstWidth, int dstHeight)
  2. scaleBitmap(Bitmap bitmap, int targetwidth)
  3. scaleBitmapIfNeededToSize(Bitmap bitmap, long size)
  4. scaleBitmapKeepRatio(Bitmap bitmap, int dstWidth, int dstHeight)
  5. scaleToTextSize(Bitmap bmp, float textSize)
  6. scaleImage(Bitmap image, float scale)
  7. scaleImg(Bitmap bitmap, float scale)
  8. scaleImg(Bitmap bitmap, int newWidth, int newHeight)
  9. scaleImg(File file, int newWidth, int newHeight)