Android Question Fatal signal 11 (SIGSEGV) at 0xfffffff1 (code=1), thread 1064 (b4a.EensKijken)

LéonE

Member
Licensed User
Longtime User
Hi,

I created folowing sub:

Sub EditText1_TextChanged (Old AsString, New AsString)
If New.Length >8Then
Msgbox("Max 8 letters","")
EditText1.Text= Old
EndIf
End Sub

the error is not the message but putting comment the line [EditText1.Text= Old] the app continues.
also the emulator stoppes with the message unfortunaly...etc...

i, however, want that the user has a max [edittext - input] of 8 characters.

Thanks for any help.
Léon
 

Attachments

  • Fatal.zip
    11 KB · Views: 129

Erel

B4X founder
Staff member
Licensed User
Longtime User
I wasn't able to reproduce it. However showing a modal dialog inside an event that can be raised multiple times can be problematic.

Try this code:
B4X:
Sub EditText1_TextChanged (Old As String, New As String)
   If New.Length >8 Then
     ToastMessageShow("Max 8 letters", False)
     EditText1.Text = New.SubString2(0, 7)
   End If
End Sub

You can also set the max length with the IME library (IME.SetLengthFilter).
 
Upvote 0

LéonE

Member
Licensed User
Longtime User
Ok this worked...only
1) the number should be 8 and not 7 or from (input 123456789) remain 1234567.
2) i'm not familiar with accessing a library can you give me and example please?
thanks.
 
Upvote 0
Top