I've got two EditText fields and a button,
EditText topNumericInputField; // Top text field
EditText bottomNumericInputField; // Bottom text field
Button clearButton; // Regular Button
I'm trying to clear the text that's in them when I change focus, my onClick method looks like this:
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.topInputField:
clearTextBoxes();
break;
case R.id.bottomNumericInputField:
clearTextBoxes();
break;
case R.id.clearButton:
clearTextBoxes();
break;
}
}
private void clearTextBoxes() {
topNumericInputField.getText().clear();
bottomNumericInputField.getText().clear();
}
Now, it clears both fields fine with either:
a) The field I click on already has focus
or
b) I click the clear button
If I change focus from the top field to the bottom field, it gets focus, then I need to click it one more time.
I'm not sure exactly what's happening, but I'm sure it's related to something that keeps coming up in the LogCat log, every time I change focus two lines appear:
Tag: IInputConnectionWrapper Text: beginBatchEdit on inactive InputConnection
Tag: IInputConnectionWrapper Text: endBatchEdit on inactive InputConnection
I've tried searching SO and I've seen some submissions that are similar, but none seem to really be what I'm looking for.
Thanks!