Android limit edittext lenght

view full story

http://stackoverflow.com – I am having problem with limiting edittext length in android. Everything works perfect except when delete message. My edit text control has max length of 16 characters and it will limit it for recognizing, displaying and reading first 16 characters but when I continue to type, it memorizes text somewhere in background and if i want to delete text it doesn't start to delete backwards from 16th character but from last one I have entered. See below code. I have even tried to add TextChangedListener it doesn't trigger 16 character is entered as there isn't any action. I am using Nexus 7 for tes (HowTos)