Android Question EditText lost focus with Hard Keyboard

Jose Cuevas

Member
Licensed User
Longtime User
Hello friends, I have an Activity with 8 EditText, if I press Enter (in a Hand Held with hard numeric keyboard) and the EditTexts are empty, the focus skip between EditTexts fine, but if the EditText are not empty, the focus start to skip 2 EditText, even some times skip all the EditText and go to the Button at the end of the Activity, totally erratic behavior.

I have tried with several HH with hard keyboard and the behavior is the same.

Also, the Enter is not detected with the Activity_KeyPress or Activity_KeyUp events.

I'm desperate because my deadline is approaching and i don't have a solution.

Thanks in advance, for your help.

Regards,
 

Daniel44

Active Member
Licensed User
Hello friends, I have an Activity with 8 EditText, if I press Enter (in a Hand Held with hard numeric keyboard) and the EditTexts are empty, the focus skip between EditTexts fine, but if the EditText are not empty, the focus start to skip 2 EditText, even some times skip all the EditText and go to the Button at the end of the Activity, totally erratic behavior.

I have tried with several HH with hard keyboard and the behavior is the same.

Also, the Enter is not detected with the Activity_KeyPress or Activity_KeyUp events.

I'm desperate because my deadline is approaching and i don't have a solution.

Thanks in advance, for your help.

Regards,
Hey José try this:
B4X:
Sub EditBox1_TextChanged (Old As String, New As String)
  
  If EditBox1.Text <> "" Then
       EditBox2.InputType = EditBox2.INPUT_TYPE_NUMBERS
       EditBox2.requestFocus
  End If
End Sub

I don't know if I undertood what you want
 
Upvote 0

Jose Cuevas

Member
Licensed User
Longtime User
Hey José try this:
B4X:
Sub EditBox1_TextChanged (Old As String, New As String)
 
  If EditBox1.Text <> "" Then
       EditBox2.InputType = EditBox2.INPUT_TYPE_NUMBERS
       EditBox2.requestFocus
  End If
End Sub

I don't know if I undertood what you want

Hola Daniel, muchas gracias por tu respuesta, el problema es con el teclado físico de la Hand Held, al ingresar un dato en el EditText y presionar Enter, se salta hasta 2 o 3 EditText, no pasa al siguiente, si uso el Enter del teclado virtual si lo hace bien.

Ya probé con el evento EnterPressed y FocusChanged y nada. Con el FocusChanged funciona bien el Enter, pero si quiere regresar a un EditText para corregir algún dato, ya no regresa, se queda en donde está el Focus.

Voy a probar tu código y te cuento.

Saludos y de nuevo muchas gracias.
 
Upvote 0
Top