Java tutorial
//package com.java2s; import android.widget.TextView; public class Main { public static int getLineCount(TextView view, String szText, int nWidth) { int nCharCount = view.getPaint().breakText(szText, 0, szText.length(), true, nWidth, null); int nLineCount = szText.length() / nCharCount; if (szText.length() > nCharCount * nLineCount) nLineCount++; return nLineCount; } }