How do can you generate a bitmap from HTML in Android?

Can the WebView be used for this or is there a better approach (like maybe using the WebView rendering engine directly)? How?

I would like to implement the following method...

public Bitmap toBitmap(Context context, String html, Rect rect);

...where html is the html to render and rect is the frame of the desired bitmap.

Edit
Report