@Override
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        if (instances++ == 0) {
            final Drawable temp = ResourcesCompat.getDrawable(getResources(), R.drawable.compass_arrow_mini, null);
            try {
                compassArrow = Bitmap.createBitmap(temp.getIntrinsicWidth(), temp.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
                final Canvas canvas = new Canvas(compassArrow);
                temp.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
                temp.draw(canvas);
            } catch (OutOfMemoryError e) {
                throw new IllegalStateException();
            }
            compassArrowWidth = compassArrow.getWidth();
            compassArrowHeight = compassArrow.getWidth();
        }
    }
pixel size of the square arrow bitmap
main/src/main/java/cgeo/geocaching/ui/CompassMiniView.java