I am developing an application that has 4 text fields for entering data into and I have come across a performance issue when moving focus from one to the other. When a field has a character entered into it I use the addTextChangedListener to monitor the text and move the focus to the next text field. This was working fine on versions of android before 4.1.1 but since testing on 4.1.1 there is a noticeable lag when you press a key before the focus appears in the next field. This means if the user types rapidly, key presses can be lost.
I have a simple app using the following code
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
one = (EditText)findViewById(R.id.editText1);
two = (EditText)findViewById(R.id.editText2);
one.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
two.requestFocus();
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
}
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
// TODO Auto-generated method stub
}
});
}
that highlights the issue. When run on a 4.0.4 based device everything is fine, but on 4.1.1 it takes a while to move the focus.
I have tested this on 2 different Samsung Galaxy s3's one with 4.0.4 and one with 4.1.1.
Has anyone else seen this?
Many thanks
Paul