protected int calcTextWidth(Paint paint,String demoText){
  Rect r=new Rect();
  paint.getTextBounds(demoText,0,demoText.length(),r);
  return r.width();
}

protected int calcTextWidth ( Paint paint , String demoText ) { Rect r = new Rect ( ) ; paint . getTextBounds ( demoText , 0 , demoText . length ( ) , r ) ; return r . width ( ) ; }
calculates the approximate width of a text , depending on a demo text avoid repeated calls ( e . g . inside drawing methods )
