@Override
protected void onDraw(Canvas canvas) {
// Draw graphic objects
.....
}
public void displayCalc(){
//Do some calculation & display results near these graphic objects
String result = String.valueOf(value);
//Do some calculation
//Display Calculated values
Canvas c =new Canvas();
Paint paint = new Paint();
paint.setStyle(Paint.Style.FILL);
paint.setAntiAlias(true);
paint.setColor(Color.WHITE);
c.drawText(result,200,300,paint);
}
But if i have the same thing in the function onDraw it works fine. I would like to know why or what changes i have to make to get it working
@Override
protected void onDraw(Canvas canvas) {
// Draw graphic objects
//Do some calculation & display results near these graphic objects
.....
String result = String.valueOf(value);
//Display Calculated values
Paint paint = new Paint();
paint.setStyle(Paint.Style.FILL);
paint.setAntiAlias(true);
paint.setColor(Color.WHITE);
canvas.drawText(result,200,300,paint);
}