Hi all, I am using a textWatcher on an editText. I am able to limit it's length, but I am unable to limit the number of lines in it. I want to allow only 4 lines (line breaks or return keys) in the editText. I am using the following method to count number of lines (line breaks), but it returns odd values.
private int countLines(String str){ String[] lines = str.split("\r\n|\n"); return lines.length; } Any suggestion/help on how to limit editText to 4 new lines? I need it urgently, so please help if you know a solution to it. Thanks in advance. Regards, Farhan -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en