### Generate Bitmap in Background Thread Source: https://github.com/izettle/android-html2bitmap/blob/develop/README.md This example demonstrates how to use AsyncTask to generate an HTML bitmap off the main thread. It sets the HTML content and context, then displays the resulting bitmap in an ImageView. ```java new AsyncTask() { @Override protected Bitmap doInBackground(Void... voids) { String html = "

Hello world!


Html bitmap"; return new Html2Bitmap.Builder().setContext(context).setContent(WebViewContent.html(html)).build().getBitmap(); } @Override protected void onPostExecute(Bitmap bitmap) { if (bitmap != null) { imageView.setImageBitmap(bitmap); } } }.execute(); ``` -------------------------------- ### Basic Bitmap Generation Source: https://github.com/izettle/android-html2bitmap/blob/develop/README.md Instantiate the Html2Bitmap builder with context and HTML content to generate a bitmap. The width of the bitmap is a required parameter. ```java Bitmap bitmap = new Html2Bitmap.Builder(context: Context, content: WebViewContent).build().getBitmap(); ``` -------------------------------- ### Add HTML to Bitmap Dependency Source: https://github.com/izettle/android-html2bitmap/blob/develop/README.md Include this dependency in your app's build.gradle file to use the html2bitmap library. ```gradle dependencies { implementation 'com.izettle:html2bitmap:1.9' } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.