text wrapping according to boundWidth
<p>hi i am new to android platform i want to perform the text should go to next line if bound width exceeds.
i have already wrote some come with my basic knowledge but it did not accomplish my target 
please help me this is the code that i wrote for aligning text </p>

<p>please help me to attain my goal</p>

<pre><code>public String[] getAlignedText(String wholeText, RectF bounds, Paint textPaint){
        String limitedString = wholeText;
        float requiredSize = 0;

        float numberOfWords= 0;



        int index = 0;
        String[]formatedString = new String[5];
        int i = 1;
        requiredSize = textPaint.measureText(limitedString);

        String temp = null; 
        numberOfWords = CountWords(wholeText);

        Log.d("bounsds width", "required Size bounds"+bounds.width());
        Log.d("bounsds width", "requiredSize"+requiredSize);

        textPaint.breakText(wholeText, true, bounds.width(), null);


        while(limitedString.equals(null)){
            if(checkSpaceAvailable(requiredSize, bounds.width())){
                formatedString[i]=limitedString;
                i++;
            }else{
                index = limitedString.lastIndexOf(" ");
                limitedString = limitedString.substring(0, index);
            }

        }
        return formatedString;
}
</code></pre>

<p>in my on drawmethod i used  whole texxt means the text to wrap
    bounds the boundary rectangle
    textpaint the paint used for drawing</p>

<pre><code>this method called from the onDraw


for (String string : tokenizedString) {
            Log.d("tokenizedString", "tokenizedString"+string);
            newPaintHeight+=20;
            if(string!=null)
            canvas.drawText(string, getBounds().left, getBounds().top+newPaintHeight, textPaint);
        }
</code></pre>

<p>thanks and Regards 
Pranav</p>
