android - Facing difficulty while adding an EditText values in a List -
i have 10 edittext field in application. want add values in list once give submit.
i have used addtextchngedlistener in code.
name.addtextchangedlistener(new textwatcher() { @override public void ontextchanged(charsequence s, int start, int before, int count) { // todo auto-generated method stub } @override public void beforetextchanged(charsequence s, int start, int count, int after) { // todo auto-generated method stub } @override public void aftertextchanged(editable s) { // todo auto-generated method stub namevalue = s.tostring(); namelist.add(namevalue); } });
but if give values means adding j, jo, joh ,john.
john michel nishan clorem
after giving submit want iterate values.
actually want see length 4. showing length based on changing every letter. how can deal this? please me. in advance.
you need remove added incomplete string before adding new string.
use following code in beforetextchanged() function:-
@override public void beforetextchanged(charsequence s, int start, int count, int after) { namevalue = s.tostring(); namelist.remove(namevalue); }
Comments
Post a Comment