i want to know how many line in my text view. i already set mytextview text, then i want to get how many line it take in mytextview.
i use mytextview.getLineCount()
The Following will provide the lines count of the textview at the same place you set tv.setText().
int maxTextViewWidth="ENTER MAX WIDTH HERE";
tv.setText("hello\nhow are you?");
int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(maxTextViewWidth, View.MeasureSpec.AT_MOST);
int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
tv.measure(widthMeasureSpec, heightMeasureSpec);
int lineCount=tv.getLineCount();