• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Re-using Paint objects?

safibaba

Newbie
Will it really slow things down if I use one text paint to draw 3 different lines of text in a repeating draw routine in different colors like this...

PHP:
textPaint.setARGB(255,255,255,255);
c.drawText("HELLO",0,0,textPaint);
textPaint.setARGB(255,255,0,0);
c.drawText("This is some more text",0,20,textPaint);
textPaint.setARGB(255,0,255,0);
c.drawText("More text",0,40,textPaint);

Or should I create 3 different Paint objects in memory and use them separately?
 
Hi safibaba,
You are using the native font from Android and I really recommend it.
So, you don't need to create 3 different Paint objects, because to change color, size or font face, is really fast.
You can use only one Paint object.
 
Back
Top Bottom