Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Edittext jumps to next edittext after reaching the maximum edittext length

In my layout I have 4 edittext.. I need to jump to the next edittext after reaching the maximum length . But there is a problem..How to do it?.. Please anybody help me to do this...

like image 675
Amith Avatar asked Jul 23 '13 05:07

Amith


1 Answers

On reachin the count you change the focus of the edittext to the next one

Edittext edt1;
Edittext edt2:
//mount the views to java from xml
edt1.addTextChangedListener(this);  
@Override
public void afterTextChanged(Editable s) {
    // 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 onTextChanged(CharSequence s, int start, int before, int count) {
    // TODO Auto-generated method stub
if(count==length){
edt2.requestFocus()
}
}
like image 134
Sreedev Avatar answered Sep 19 '22 11:09

Sreedev