Code example for Bitmap

Methods: createScaledBitmapgetWidth

    private void scaleBitmap() { 
        // If the Favicon can be resized to fill the view exactly without an enlargment of more than 
        // a factor of two, do so. 
        int doubledSize = mIconBitmap.getWidth()*2;
        if (mActualWidth > doubledSize) {
            // If the view is more than twice the size of the image, just double the image size 
            // and do the rest with padding. 
            mIconBitmap = Bitmap.createScaledBitmap(mIconBitmap, doubledSize, doubledSize, true);
        } else { 
            // Otherwise, scale the image to fill the view. 
            mIconBitmap = Bitmap.createScaledBitmap(mIconBitmap, mActualWidth, mActualWidth, true);
     * Helper method to display background of the dominant colour of the favicon to pad the remaining 
     * space.