Android Question Activity_KeyPress not firing after Activity.RemoveAllViews

TheMightySwe

Active Member
Licensed User
Longtime User
Hi,

To my application i have a barcode-scanner connected as a Bluetooth keyboard. It works fine in the first screen on my app, but if i reset the activitys views with Activity.RemoveAllViews and draw new views the Activity_KeyPress isnt firing anymore.

I have tried to add Activity.RequestFocus after redrawing all the views.

Does anyone has any idea what the problem can be?

// TMS
 

TheMightySwe

Active Member
Licensed User
Longtime User
Yes I have, and it's not firing after i add views to the Activity. But after i click some button i starts working again.

/TMS
 
Upvote 0

TheMightySwe

Active Member
Licensed User
Longtime User
I'm posting a video to show the problem.
Tried this code:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Activity.RemoveAllViews
End Sub

Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
   Log(KeyCode)
   Return True
End Sub
Works correctly.


Look at video.

1. First scanner works...
2. I start other part of program
3. Scanner don't work
4. I click on a button
5. Scanner works again.


The video shows the problem. Maybe it's the Toastmessage that screws things up?
 
Upvote 0
Top