Given a multi-line EditText, how can I know the line number at cursor position?
A:
Take the text of the control and put it in a string. Loop over the string up to the index of the cursor position and count the number of newlines.
wllmsaccnt
2010-10-27 14:50:14
The text is wrapped. I has no newlines.
alex2k8
2010-10-27 14:55:02
A:
Something like textview.getPaint().measureText(textview.getText().toString()) / textView.getWidth();
This assumes the cursor is at the end of the text, if not you gotta use substring measure.
Sorry for brevity on my iPad
schwiz
2010-10-27 14:55:01