code: public Bitmap getViewBitmap() {
          if (view!=null)
              return null;
          Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
          Canvas canvas = new Canvas(bitmap);
  
          view.layout(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
          view.draw(canvas);
  
          return bitmap;
      }
docs: Get Bitmap for current view
  @return