Backspace Issue

Phantomco

Member
Licensed User
Longtime User
Odd issue when using the backspace key in an editText view. The backspace key works okay unless it encounters a space in the text. It then jumps out of the activity; or at least suspends it.

I have keypress code in place on the activity, but this behavior is strange

B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 
If WebView1.Visible= True Then
   WebView1.Back
   Return True
Else
   Dim Answ As Int
   If KeyCode = KeyCodes.KEYCODE_BACK Then
      Answ = Msgbox2("Do you want to quit the program ?", "A T T E N T I O N", "Yes", "", "No", Null)
      If Answ = DialogResponse.NEGATIVE Then
         Return True
      End If
   End If
End If
Activity.Finish
End Sub

Any thoughts??

Thanks

Mike
 

Phantomco

Member
Licensed User
Longtime User
Backspace

Erel,

No, I'm not doing anything with that editText but saving the text later on.
The behavior is the same on Samsung and Acer tablets. It works fine until you hit a space...

Also, the behavior is the same in another editText in the app and single vs multi-line doesn't make a difference.

Thanks

Mike
 
Last edited:
Upvote 0

Phantomco

Member
Licensed User
Longtime User
Clarification

If this is any help, once the error occurs and the app closes, the error will not happen again as long as you do an action to resume the app vs. restart.

Klaus, I'm having trouble duplicating this outside of the app as well and the app has a few databases and remote connections in it that make it hard to "zip up". On the bright side, you reminded me that our Swiss exchange 'daughter' will be back here visiting in just about a month :)

Mike
 
Upvote 0

Phantomco

Member
Licensed User
Longtime User
Backspace

Here's two log segments, one filtered, one not. The first log is the new-old from textchanged as I hit the backspace key. It removes the 'w' okay, then when it goes to remove the space, it dies.

asd we - asd w
asd w - asd
asd - asd
** Activity (main) Pause, UserClosed = true **

Delivering touch to current input target: action: 0x0
Minimum buffer size corrected from 2048 to 4096
startOutput() output 1, stream 1, session 37
getDeviceForStrategy() from cache strategy 0, device 2
changeRefCount() stream 1, count 1
getDeviceForStrategy() from cache strategy 0, device 2
getNewDevice() selected device 2
setOutputDevice() output 1 device 2 delayMs 0 force 0
setOutputDevice output :0x1 mCurDevice:0x2
setOutputDevice() setting same device 2 or null device for output 1
releaseOutput() 1
asd - asd
Touch event's action is 0x1 (deviceType=0) [pCnt=1, pending(waiting finished signal)=0, s=]
Delivering touch to current input target: action: 0x1
Delivering touch to current input target: action: 0x1
stopOutput() output 1, stream 1, session 37
changeRefCount() stream 1, count 0
getNewDevice() selected device 0
setOutputDevice() output 1 device 0 delayMs 184 force 0
setOutputDevice() setting same device 0 or null device for output 1
** Activity (main) Pause, UserClosed = true **
 
Upvote 0

Phantomco

Member
Licensed User
Longtime User
Turned out to be a activity keypress event. I was attempting to catch the back button (not a backspace, at least in my mind) to keep people from exiting out unintentionally when viewing a web page.

I had an error in the code that let the event code hit an activity.finish call in error. But it should have been hitting that anytime the backspace was pressed.

My take on this is that as long as there was an actual character being deleted, it didn't treat it as a "Back button", just a back space.

This was the bad code, which I think should have failed miserably from the start as I left out the test for the keycode

B4X:
Activity_KeyPress (KeyCode As Int) As Boolean
If WebView1.Visible= True Then
   WebView1.Back
   Return True
Else
   Dim Answ As Int
   If KeyCode = KeyCodes.KEYCODE_BACK Then
      Answ = Msgbox2("Do you want to quit the program ?", "A T T E N T I O N", "Yes", "", "No", Null)
      If Answ = DialogResponse.NEGATIVE Then
         Return True
      End If
   End If
End If
'Return False
Activity.Finish

Mike
 
Upvote 0
Top