java - Get number of characters in a single line android EditText -
in edittext
, when long text entered, edit text moves text line. how can find out index in string edittext
has ended line on?
ie when type in edittext
, after words edittext
's line ends, , cursor moves new line. point want find, after how many characters cursor moves new line.
so, in image want index of last "e" (from 'online') in first line, "e" of 'google' in 2nd , on:
edittext.addtextchangedlistener(new textwatcher() { int currentline=1; @override public void ontextchanged(charsequence arg0, int arg1, int arg2, int count) { if(edittext.getlinecount() > currentline) { log.d("new line ", "line"); log.d("no. of characters in"+currentline+" line", count-1); currentline++; } } });
Comments
Post a Comment