Code example for RoundRectShape

0
    @SuppressWarnings("deprecation") 
    public void setBackground(int dipRadius, int badgeColor) {
        int radius = dip2Px(dipRadius);
        float[] radiusArray = new float[] { radius, radius, radius, radius, radius, radius, radius, radius };
 
        RoundRectShape roundRect = new RoundRectShape(radiusArray, null, null);
        ShapeDrawable bgDrawable = new ShapeDrawable(roundRect);
        bgDrawable.getPaint().setColor(badgeColor);
        setBackgroundDrawable(bgDrawable);
    } 
 
    /** 
     * @return Returns true if view is hidden on badge value 0 or null; 
     */ 
    public boolean isHideOnNull() { 
        return mHideOnNull;
    } 
 
    /** 
     * @param hideOnNull the hideOnNull to set