Code example for NinePatchDrawable

        if (chunk != null && bitmap != null) {
            int[] padding = chunk.getPadding();
            Rect paddingRect = new Rect(padding[0], padding[1], padding[2], padding[3]);
            return new NinePatchDrawable(context.getResources(), bitmap,
                    paddingRect, null);
        return null; 
    // ------- TypedValue stuff 
    // This is taken from //device/libs/utils/ResourceTypes.cpp 
    private static final class UnitEntry { 
        String name;
        int type;
        int unit;
Connect your IDE to all the code out there  Get Codota for Java