I have a TextView
that is X lines long. How do I get the text that is at, say, line 3?
Example: I have this TextView
Here is some code to supplement the accepted answer:
List lines = new ArrayList<>();
int count = textView.getLineCount();
for (int line = 0; line < count; line++) {
int start = textView.getLayout().getLineStart(line);
int end = textView.getLayout().getLineEnd(line);
CharSequence substring = textView.getText().subSequence(start, end);
lines.add(substring);
}