How do you prevent someone from entering the following into an EditText where setLines = 4?
dfa
d
ads
dd
adf
adf
ddf
ad
ddas
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well, you can’t really prevent someone from entering more than four lines. If he just types without manually adding newlines, you will never know how many lines he entered.
However, you can limit the number of manually added newlines (via the enter key) by hooking on the
OnKeyListenerof theEditView:It’s quite a hacky method, but the only I can come up with so far…