Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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;
    }
}