I'm trying to save the Canvas object in a onDraw() method.
This is because i'm using a foreach loop in the onDraw method resulting in :
canvas.DrawText (textitem , x,y, textpaint);
(i have to do this because im drawing the text around a masked area)
what im trying now is this :
@Override
public void onDraw(Canvas canvas)
{
if (hasrun = false)
{
for(CustomTextViewDrawItem item : drawItemList)
{
canvas.drawText(item.Text, item.X, item.Y, textPaint);
}
if (eLabel.backgroundGradient != null)
{
canvas.drawPath(path, fillPaint);
}
canvas.save();
savedCanvas = canvas ;
}
else
{
canvas = savedCanvas;
}
hasrun = true;
super.onDraw(canvas);
}
when debugging I see it looks ok, but comes out empty . what would be the best way to get this working ?