Spanish error con codigo de barras por bluetooth

CRISTIAN_JOVE

New Member
buenas tardes soy nuevo y escribi donde no debia gracias a erel que me deribo aqui...les comento el inconveniente...estoy intentando leer codigos de barras con una pistola bluetooth y capturarlos en un edittexbox al ingresar el codigo de barras manualmente desde el teclado todo funciona bien pero al leer con la pistola capturo el salto de linea y al entrar en el evento EnterPressed la app se cierra ...no puede descubrir el error .....adjunto log y codigo por si alguien me puede dar una nano...desde ya muchas gracias y sepan disculpar la desprolijidad el codigo leido es 200700031

ViewRoot's KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_2, scanCode=3, metaState=0, flags=0x8, repeatCount=0, eventTime=2780852, downTime=2780852, deviceId=11, source=0x101 } to DecorView@5d7b39a[main]
AudioManagerEx created
50
ViewRoot's KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_0, scanCode=11, metaState=0, flags=0x8, repeatCount=0, eventTime=2780852, downTime=2780852, deviceId=11, source=0x101 } to DecorView@5d7b39a[main]
48
ViewRoot's KeyEvent { action=ACTION_UP, keyCode=KEYCODE_2, scanCode=3, metaState=0, flags=0x8, repeatCount=0, eventTime=2780862, downTime=2780852, deviceId=11, source=0x101 } to DecorView@5d7b39a[main]
ViewRoot's KeyEvent { action=ACTION_UP, keyCode=KEYCODE_0, scanCode=11, metaState=0, flags=0x8, repeatCount=0, eventTime=2780862, downTime=2780852, deviceId=11, source=0x101 } to DecorView@5d7b39a[main]
ViewRoot's KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_0, scanCode=11, metaState=0, flags=0x8, repeatCount=0, eventTime=2780883, downTime=2780883, deviceId=11, source=0x101 } to DecorView@5d7b39a[main]
48
ViewRoot's KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_7, scanCode=8, metaState=0, flags=0x8, repeatCount=0, eventTime=2780883, downTime=2780883, deviceId=11, source=0x101 } to DecorView@5d7b39a[main]
55
ViewRoot's KeyEvent { action=ACTION_UP, keyCode=KEYCODE_0, scanCode=11, metaState=0, flags=0x8, repeatCount=0, eventTime=2780889, downTime=2780883, deviceId=11, source=0x101 } to DecorView@5d7b39a[main]
ViewRoot's KeyEvent { action=ACTION_UP, keyCode=KEYCODE_7, scanCode=8, metaState=0, flags=0x8, repeatCount=0, eventTime=2780889, downTime=2780883, deviceId=11, source=0x101 } to DecorView@5d7b39a[main]
ViewRoot's KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_0, scanCode=11, metaState=0, flags=0x8, repeatCount=0, eventTime=2780916, downTime=2780916, deviceId=11, source=0x101 } to DecorView@5d7b39a[main]
48
ViewRoot's KeyEvent { action=ACTION_UP, keyCode=KEYCODE_0, scanCode=11, metaState=0, flags=0x8, repeatCount=0, eventTime=2780923, downTime=2780916, deviceId=11, source=0x101 } to DecorView@5d7b39a[main]
ViewRoot's KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_0, scanCode=11, metaState=0, flags=0x8, repeatCount=0, eventTime=2780949, downTime=2780949, deviceId=11, source=0x101 } to DecorView@5d7b39a[main]
48
ViewRoot's KeyEvent { action=ACTION_UP, keyCode=KEYCODE_0, scanCode=11, metaState=0, flags=0x8, repeatCount=0, eventTime=2780954, downTime=2780949, deviceId=11, source=0x101 } to DecorView@5d7b39a[main]
ViewRoot's KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_0, scanCode=11, metaState=0, flags=0x8, repeatCount=0, eventTime=2780981, downTime=2780981, deviceId=11, source=0x101 } to DecorView@5d7b39a[main]
48
ViewRoot's KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_3, scanCode=4, metaState=0, flags=0x8, repeatCount=0, eventTime=2780981, downTime=2780981, deviceId=11, source=0x101 } to DecorView@5d7b39a[main]
51
ViewRoot's KeyEvent { action=ACTION_UP, keyCode=KEYCODE_0, scanCode=11, metaState=0, flags=0x8, repeatCount=0, eventTime=2780988, downTime=2780981, deviceId=11, source=0x101 } to DecorView@5d7b39a[main]
ViewRoot's KeyEvent { action=ACTION_UP, keyCode=KEYCODE_3, scanCode=4, metaState=0, flags=0x8, repeatCount=0, eventTime=2780988, downTime=2780981, deviceId=11, source=0x101 } to DecorView@5d7b39a[main]
ViewRoot's KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_1, scanCode=2, metaState=0, flags=0x8, repeatCount=0, eventTime=2781012, downTime=2781012, deviceId=11, source=0x101 } to DecorView@5d7b39a[main]
49
ViewRoot's KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_ENTER, scanCode=28, metaState=0, flags=0x8, repeatCount=0, eventTime=2781012, downTime=2781012, deviceId=11, source=0x101 } to DecorView@5d7b39a[main]
ViewRoot's KeyEvent { action=ACTION_UP, keyCode=KEYCODE_1, scanCode=2, metaState=0, flags=0x28, repeatCount=0, eventTime=2782041, downTime=2781012, deviceId=11, source=0x101 } to DecorView@5d7b39a[main]
ViewRoot's KeyEvent { action=ACTION_UP, keyCode=KEYCODE_ENTER, scanCode=28, metaState=0, flags=0x28, repeatCount=0, eventTime=2782041, downTime=2781012, deviceId=11, source=0x101 } to DecorView@5d7b39a[main]
ViewRoot's KeyEvent { action=ACTION_UP, keyCode=KEYCODE_1, scanCode=2, metaState=0, flags=0x8, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 } to DecorView@f2a097f[]
Dropping or Cancelling event: mStopped=false mPausedForTransition=false
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_1, scanCode=2, metaState=0, flags=0x28, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 }
Dropping or Cancelling event: mStopped=false mPausedForTransition=false
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_1, scanCode=2, metaState=0, flags=0x28, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 }
Dropping or Cancelling event: mStopped=false mPausedForTransition=false
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_1, scanCode=2, metaState=0, flags=0x28, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 }
Dropping or Cancelling event: mStopped=false mPausedForTransition=false
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_1, scanCode=2, metaState=0, flags=0x28, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 }
AudioManagerEx created
Dropping or Cancelling event: mStopped=false mPausedForTransition=false
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_1, scanCode=2, metaState=0, flags=0x28, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 }
Dropping or Cancelling event: mStopped=false mPausedForTransition=false
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_1, scanCode=2, metaState=0, flags=0x28, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 }
Dropping or Cancelling event: mStopped=false mPausedForTransition=false
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_1, scanCode=2, metaState=0, flags=0x28, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 }
Dropping or Cancelling event: mStopped=false mPausedForTransition=false
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_1, scanCode=2, metaState=0, flags=0x28, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 }
Dropping or Cancelling event: mStopped=false mPausedForTransition=false
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_1, scanCode=2, metaState=0, flags=0x28, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 }
Dropping or Cancelling event: mStopped=false mPausedForTransition=false
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_1, scanCode=2, metaState=0, flags=0x28, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 }
ViewRoot's KeyEvent { action=ACTION_UP, keyCode=KEYCODE_ENTER, scanCode=28, metaState=0, flags=0x8, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 } to DecorView@f2a097f[]
Dropping or Cancelling event: mStopped=false mPausedForTransition=false
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_ENTER, scanCode=28, metaState=0, flags=0x28, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 }
Dropping or Cancelling event: mStopped=false mPausedForTransition=false
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_ENTER, scanCode=28, metaState=0, flags=0x28, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 }
Dropping or Cancelling event: mStopped=false mPausedForTransition=false
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_ENTER, scanCode=28, metaState=0, flags=0x28, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 }
Dropping or Cancelling event: mStopped=false mPausedForTransition=false
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_ENTER, scanCode=28, metaState=0, flags=0x28, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 }
Dropping or Cancelling event: mStopped=false mPausedForTransition=false
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_ENTER, scanCode=28, metaState=0, flags=0x28, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 }
Dropping or Cancelling event: mStopped=false mPausedForTransition=false
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_ENTER, scanCode=28, metaState=0, flags=0x28, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 }
Dropping or Cancelling event: mStopped=false mPausedForTransition=false
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_ENTER, scanCode=28, metaState=0, flags=0x28, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 }
Dropping or Cancelling event: mStopped=false mPausedForTransition=false
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_ENTER, scanCode=28, metaState=0, flags=0x28, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 }
Dropping or Cancelling event: mStopped=false mPausedForTransition=false
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_ENTER, scanCode=28, metaState=0, flags=0x28, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 }
Dropping or Cancelling event: mStopped=false mPausedForTransition=false
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_ENTER, scanCode=28, metaState=0, flags=0x28, repeatCount=0, eventTime=2781020, downTime=2781012, deviceId=11, source=0x101 }
finishComposingText on inactive InputConnection
finishComposingText on inactive InputConnection
Do partial code cache collection, code=19KB, data=31KB
After code cache collection, code=19KB, data=31KB
Increasing code cache capacity to 128KB

--------codigo
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.

Private EditText1 As EditText
Private Button1 As Button
Private Label1 As Label
Dim UltimoChar = -1 As Int
End Sub

Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("1")

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub Button1_Click
For i = 0 To EditText1.Text.Length - 1
Log(Asc(EditText1.Text.CharAt(i)))
Next
End Sub
Sub EditText1_TextChanged (Old As String, New As String)

Try
UltimoChar = Asc(New.SubString(EditText1.Text.Length-1))
Log(UltimoChar)
Catch
Log(LastException)
End Try
If UltimoChar = 10 Then
EditText1.Text=EditText1.Text.SubString2(0,EditText1.Text.Length-1) ' Quito el salto de línea.
'EditText1.RequestFocus

Else
'....
End If

End Sub

Sub EditText1_EnterPressed

Log("Pulsado Enter")
Log( UltimoChar)
End Sub
 

José J. Aguilar

Expert
Licensed User
Hola:

Por favor, escribe el código y los logs entre etiquetas [code]... tu código ... [/code] para hacerlo más legible.
Ese log, es en modo release o en modo debug? Prueba en modo debug, el log debería ser más claro.
¿Qué pasa si borras la línea Log( UltimoChar) ?
 

oparra

Well-Known Member
Licensed User
las pistolas lectoras de código barra, se pueden configurar con o sin salto de linea automático.

Si estas leyendo un código de barra desde un edittext, este en forma automática saltara al siguiente campo o bien se gatillara los eventos de TextChanged o FocusChanged donde podrás chequear el valor capturado.

Es por eso que debes ver primero la configuración de tu pistola de código de barra.

Normalmente lo usual es dejarlo automático para evitar la digitación y solo validar los datos en los eventos correspondiente TextChanged o FocusChanged.

Saludos.
 
Last edited:

CRISTIAN_JOVE

New Member
buenas tardes chicos....jose gracias por las observaciones sere mas cuidadoso las disculpas del caso...voy a probar con lo que me sugeris y cualquier cosa subire nuevamente y ordenado tanto el log como el codigo.....oparra gracias por las observaciones sobre la pistola...vere un poco mas ...hago unas pruebas y les comento......pregunta se pueden capturar los datos antes de que los muestre el edittext???es decir juntarlos en una variable y mostrarlos cuando la recepcion haya finalizado en este caso el salto de linea
 
Top