I have created a custom view by extending the TextView widget. What it basically does is a Round view with some text above the Circle which acts as a background.
Now I need the same view again but without the text. Is there a way I can reuse the same code - instead of just copy/paste the code to create a View class without the text?
The onDraw code with the text is :
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawCircle(150, 150, 150, paintBG);
canvas.drawText("Some Text", 0, 150, textPaint);
}
EDIT : what i need is some kind of an if statement where the drawtext happens. If my view needs the text label then use the drawText. I just don't know what the condition should be since I use the code to my xml layout file.