[BUI] problem on setting focus on text field

i have two textfields one for username and one for password. very typical.



im trying to change the keyboard focus from the one which has the focus right now to the other one when tab key is pressed.



this is the code,



      if(state.getUsernameField().hasFocus())
      {
         state.getPasswordField().requestFocus();
      }
      else if(state.getPasswordField().hasFocus())
      {
         state.getUsernameField().requestFocus();
      }



problem is that when after the line state.getPasswordField().requestFocus(); either of the text fields has focus anymore.

help plz~ :(

HELP~~~