I'm using a custom font and adding text to a canvas with a Paint object in android, e.g:

Paint paint = new Paint();
paint.setARGB(255, 255, 255, 255);

paint.setTextSize(29);
paint.setAntiAlias(true);
paint.setTypeface(font);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); // Text Overlapping Pattern

final TextPaint tp = new TextPaint(paint);
final TextPaint tpStroke = new TextPaint(strokePaint);

// canvas.translate(15, 5);
canvas.translate(20, 5);

StaticLayout sl = new StaticLayout(textOne.getText().toString(), tp, (finalBitmapOne.getWidth()-10), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);

sl.draw(canvas);


I'm not happy with the leading / line height, how can I adjust it?

I can get the leading via:

FontMetrics fmPaint = paint.getFontMetrics();
fmPaint.leading;


But how can I adjust it?


Question: android using async http connection to get image bitmap
Answer: Now that a binary response handler has been added to AsyncHttp you can simply use androids BitmapFactory.decodeByeArray function:

AsyncHttpClient client = new AsyncHttpClient();
client.get(image_url, null, new AsyncHttpResponseHandler() {            
    @Override
    public void onSuccess(byte[] fileData) {
        Bitmap image = BitmapFactory.decodeByteArray(fileData, 0, fileData.length);
        //Do whatever you want with the image variable    
    }
});