Question: I would like to know how to create a clickable button in HTML format that sits on in the center of a header image.

I have tried to use the button tags along with the href attribute along with the img tags to try to wrap the code around the desired image but it doesn't work. An example of the result that I am trying to achieve can be found in the header on [github.com](http://github.com).

Answer: 
You need to call `WebView.enableSlowWholeDocumentDraw()` before creating *any* WebViews in your app. 

That is, if you have a WebView somewhere in your static layout, make sure you call `WebView.enableSlowWholeDocumentDraw()` before your first call to `setContentView()` that inflates a layout with WebView.

Also make sure that your WebView is indeed big. For example, if its layout size is set to `match_parent`, then your WebView will have the size of the screen, and this is what will be captured. You need to set some artificially high values for width and height. This question contains a nice illustration for that: [WebView.draw() not properly working on latest Android System WebView Update](https://stackoverflow.com/questions/30078157/webview-draw-not-properly-working-on-latest-android-system-webview-update)
```
if(Build.VERSION.SDK_INT>=21)    {
    WebView.enableSlowWholeDocumentDraw();
}

public void capture(WebView webView) {
    WebView lObjWebView = webView;
    lObjWebView.measure(MeasureSpec.makeMeasureSpec(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
    lObjWebView.layout(0, 0, lObjWebView.getMeasuredWidth(), lObjWebView.getMeasuredHeight());
    Bitmap bm = Bitmap.createBitmap(lObjWebView.getMeasuredWidth(), lObjWebView.getMeasuredHeight(), Bitmap.Config.ARGB_8888);

    Canvas bigcanvas = new Canvas(bm);
    Paint paint = new Paint();
    int iHeight = bm.getHeight();
    bigcanvas.drawBitmap(bm, 0, iHeight, paint);
    lObjWebView.draw(bigcanvas);

    if (bm != null) {
        try {
            File dir = new File(Environment.getExternalStorageDirectory() + "/" + "folder");

            Calendar lObjCalendar = Calendar.getInstance();

            int hour = lObjCalendar.get(Calendar.HOUR);
            int min = lObjCalendar.get(Calendar.MINUTE);
            int sec = lObjCalendar.get(Calendar.SECOND);
            int mili = lObjCalendar.get(Calendar.MILLISECOND);
            int day = lObjCalendar.get(Calendar.DAY_OF_YEAR);
            int month = lObjCalendar.get(Calendar.MONTH);
            int year = lObjCalendar.get(Calendar.YEAR);

            String realDate = "ERS_" + day + month + year + "_" + hour + min + sec + mili;

            if (dir.exists()) {
                OutputStream fOut = null;
                File file = new File(dir, realDate + ".jpg");
                fOut = new FileOutputStream(file);

                bm.compress(Bitmap.CompressFormat.PNG, 50, fOut);
                fOut.flush();
                fOut.close();
                bm.recycle();
            }
            else {

                if (dir.mkdir()) {
                    OutputStream fOut = null;
                    File file = new File(dir, realDate + ".jpg");
                    fOut = new FileOutputStream(file);

                    bm.compress(Bitmap.CompressFormat.PNG, 50, fOut);
                    fOut.flush();
                    fOut.close();
                    bm.recycle();
                }
                else {
                    ProjectUtil.showToast(WebPayment.this, "Problem in saving webview in external storage");
                }
            }
        }
        catch (FileNotFoundException e) {
            ProjectUtil.showToast(WebPayment.this, "Problem in saving webview in external storage");
        }
        catch (IOException e) {
            ProjectUtil.showToast(WebPayment.this, "Problem in saving webview in external storage");
        }
        catch (Exception e) {
            ProjectUtil.showToast(WebPayment.this, "Problem in saving webview in external storage");
        }
    }
}

```