When I press DEL button to clear one tile (cursor is visible), the previous tile is also cleared. I debugged the code and found out that the problem maybe is in onKey() method:
else if (currentTag > 0) {
mDelPressed = true;
if (editTextList.get(currentTag).length() == 0) {
//Takes it back one tile
editTextList.get(currentTag - 1).requestFocus();
//Clears the tile it just got to
editTextList.get(currentTag).setText("");
} else {
//If it has some content clear it first
editTextList.get(currentTag).setText("");
}
}
I can't figure it out why calling setText("") when current tile has already length = 0. The previous tile has gained focus and so the currentFocus has been changed. Now calling setText("") on cached currentTag causes textChangeListener to get called and:
else if (charSequence.length() == 0) {
int currentTag = getIndexOfCurrentFocus();
mDelPressed = true;
//For the last cell of the non password text fields. Clear the text without changing the focus.
if (editTextList.get(currentTag).getText().length() > 0)
editTextList.get(currentTag).setText("");
}
Above lines clears the previous tile, because currentTag is now updated and previous tile is the currentFocus.
In fact, I can't understand why we should pass the focus to previous tile when DEL button is pressed!! We've cleared a tile to insert a new value on it.
When I press DEL button to clear one tile (cursor is visible), the previous tile is also cleared. I debugged the code and found out that the problem maybe is in
onKey()
method:I can't figure it out why calling
setText("")
when current tile has already length = 0. The previous tile has gained focus and so thecurrentFocus
has been changed. Now callingsetText("")
on cachedcurrentTag
causestextChangeListener
to get called and:Above lines clears the previous tile, because
currentTag
is now updated and previous tile is thecurrentFocus
.