Java tutorial
//package com.java2s; // Use of this source code is governed by a BSD-style license that can be import android.graphics.Bitmap; import android.graphics.Color; public class Main { /** * Returns true if we should add padding to this icon. We use a heuristic that if the pixels in * all four corners of the icon are not transparent, we assume the icon is square and maximally * sized, i.e. in need of padding. Otherwise, no padding is added. */ private static boolean shouldPadIcon(Bitmap icon) { int maxX = icon.getWidth() - 1; int maxY = icon.getHeight() - 1; if ((Color.alpha(icon.getPixel(0, 0)) != 0) && (Color.alpha(icon.getPixel(maxX, maxY)) != 0) && (Color.alpha(icon.getPixel(0, maxY)) != 0) && (Color.alpha(icon.getPixel(maxX, 0)) != 0)) { return true; } return false; } }