textview.getLineCount always 0 in android

I know this question is quite old, but in case anyone comes here looking for the actual answer:

holder.text2.setText(arr2[position]);
holder.text2.post(new Runnable() {
    @Override
    public void run() {
        int lineCnt = holder.text2.getLineCount();
        // Perform any actions you want based on the line count here.
    }
});

Leave a Comment