CommonsWare makes an excellent point: you can't prevent the user from adding more characters to the EditText box, however you can listen to what's changed and act on that. Here's how to:
EditText editbox = (EditText) findViewById(R.id.MyEditBoxName);
editbox.addTextChangedListener(new TextWatcher()
{
public void beforeTextChanged(CharSequence s, int start, int count, int after)
{
}
public void onTextChanged(CharSequence s, int start, int before, int count)
{
}
public void afterTextChanged(Editable s)
{
// Test s for length, request focus for the next edit.
// editbox2.requestFocus();
}
});
Be careful not to get yourself into an infinite loop changing the editbox, any changes you make will cause these methods to be called again recursively.