Android, Drawable.createFromStream(is, srcname): what's the 2nd parameter meaning?
It's basically useless:
Based on Froyo source, it is used when creating nine-patch images from the resource, but not when creating a regular Bitmap:
852 private static Drawable drawableFromBitmap(Resources res, Bitmap bm, byte[] np,
853 Rect pad, String srcName) {
854
855 if (np != null) {
856 return new NinePatchDrawable(res, bm, np, pad, srcName);
857 }
858
859 return new BitmapDrawable(res, bm);
860 }
You get there by following the Drawable code:
createFromStream
returns:
return createFromResourceStream(null, null, is, srcName, null);
which in turn uses:
return drawableFromBitmap(res, bm, np, pad, srcName);
(np comes from Bitmap#getNinePatchChunk();
) and this calls:
return new NinePatchDrawable(res, bm, np, pad, srcName);
Finally, you get to the NinePatch declaration:
public class NinePatch
Create a drawable projection from a bitmap to nine patches.
Parameters:
bitmap The bitmap describing the patches.
chunk The 9-patch data chunk describing how the underlying bitmap is split apart and drawn.
srcName The name of the source for the bitmap. Might be null.