I asked [this](https://stackoverflow.com/questions/31336842/draw-arabic-text-to-canvas-for-printing) question about drawing text to a canvas and I was informed I could add a text view to a layout and draw the layout to the canvas like [this](https://stackoverflow.com/questions/5242757/how-to-draw-textview-on-canvas-in-android)

My problem is, when I try to convert to bmp and display I get a black rect.

Here is my code:

```
  LinearLayout layout = new LinearLayout(getActivity());
    TextView textView = new TextView(getActivity());
    textView.setVisibility(View.VISIBLE);
    textView.setText("صيققق٣يفاوووووومالؤؤتمكا");
    layout.addView(textView);
    layout.setBackgroundColor(getActivity().getResources().getColor(R.color.transparent));
    textView.setTextColor(getResources().getColor(R.color.white));
    layout.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
    Bitmap bitmap = Bitmap.createBitmap(layout.getMeasuredWidth(), layout.getMeasuredHeight(), Bitmap.Config.RGB_565);
    //layout.draw(canvas);
    Canvas canvas = new Canvas(bitmap);
    layout.layout(0,0, canvas.getWidth(), canvas.getHeight());
    layout.draw(canvas);

```

I know I'm going wrong but I don't know where, I think I'm following the correct steps..

Can someone point out to me where I'm going wrong. Thanks