hi
I must control the insertion in a text edit.
the values must lie between 1 and 360
I wrote this code but it crashes the app
Logs
java.lang.StackOverflowError
at android.text.SpanSet.init(SpanSet.java:46)
at android.text.TextLine.set(TextLine.java:216)
at android.text.Layout.getHorizontal(Layout.java:854)
at android.text.Layout.getHorizontal(Layout.java:833)
at android.text.Layout.getPrimaryHorizontal(Layout.java:808)
at android.text.Layout.getPrimaryHorizontal(Layout.java:798)
at android.widget.TextView.getFocusedRect(TextView.java:6329)
at android.view.FocusFinder.findNextFocus(FocusFinder.java:120)
at android.view.FocusFinder.findNextFocus(FocusFinder.java:94)
at android.view.FocusFinder.findNextFocus(FocusFinder.java:65)
at android.view.ViewGroup.focusSearch(ViewGroup.java:691)
at android.view.ViewGroup.focusSearch(ViewGroup.java:693)
at android.view.ViewGroup.focusSearch(ViewGroup.java:693)
at android.view.ViewGroup.focusSearch(ViewGroup.java:693)
at android.view.ViewGroup.focusSearch(ViewGroup.java:693)
at android.view.View.focusSearch(View.java:6851)
at android.widget.TextView.onCreateInputConnection(TextView.java:6936)
at android.view.inputmethod.InputMethodManager.startInputInner(InputMethodManager.java:1233)
at android.view.inputmethod.InputMethodManager.restartInput(InputMethodManager.java:1183)
at android.widget.TextView.setText(TextView.java:4655)
at android.widget.TextView.setText(TextView.java:4572)
at android.widget.EditText.setText(EditText.java:109)
at android.widget.TextView.setText(TextView.java:4547)
at anywheresoftware.b4a.objects.TextViewWrapper.setText(TextViewWrapper.java:39)
at anywheresoftware.b4a.objects.EditTextWrapper.setText(EditTextWrapper.java:213)
at b4a.example.main._numtxt_textchanged(main.java:654)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:173)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:161)
at anywheresoftware.b4a.objects.EditTextWrapper$1.afterTextChanged(EditTextWrapper.java:83)
at android.widget.TextView.sendAfterTextChanged(TextView.java:8740)
at android.widget.TextView.setText(TextView.java:4744)
at android.widget.TextView.setText(TextView.java:4572)
at android.widget.EditText.setText(EditText.java:109)
at android.widget.TextView.setText(TextView.java:4547)
at anywheresoftware.b4a.objects.TextViewWrapper.setText(TextViewWrapper.java:39)
at anywheresoftware.b4a.objects.EditTextWrapper.setText(EditTextWrapper.java:213)
at b4a.example.main._numtxt_textchanged(main.java:654)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:173)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:161)
at anywheresoftware.b4a.objects.EditTextWrapper$1.afterTextChanged(EditTextWrapper.java:83)
at android.widget.TextView.sendAfterTextChanged(TextView.java:8740)
at android.widget.TextView.setText(TextView.java:4744)
at android.widget.TextView.setText(TextView.java:4572)
at android.widget.EditText.setText(EditText.java:109)
at android.widget.TextView.setText(TextView.java:4547)
at anywheresoftware.b4a.objects.TextViewWrapper.setText(TextViewWrapper.java:39)
at anywheresoftware.b4a.objects.EditTextWrapper.setText(EditTextWrapper.java:213)
at b4a.example.main._numtxt_textchanged(main.java:654)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:173)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:161)
at anywheresoftware.b4a.objects.EditTextWrapper$1.afterTextChanged(EditTextWrapper.java:83)
at android.widget.TextView.sendAfterTextChanged(TextView.java:8740)
at android.widget.TextView.setText(TextView.java:4744)
at android.widget.TextView.setText(TextView.java:4572)
at android.widget.EditText.setText(EditText.java:109)
at android.widget.TextView.setText(TextView.java:4547)
at anywheresoftware.b4a.objects.TextViewWrapper.setText(TextViewWrapper.java:39)
at anywheresoftware.b4a.objects.EditTextWrapper.setText(EditTextWrapper.java:213)
I must control the insertion in a text edit.
the values must lie between 1 and 360
I wrote this code but it crashes the app
B4X:
Sub numTxt_TextChanged (Old As String, New As String)
If New.Length > 3 Then numTxt.text = Old
If sf.Val(New)< 1 OR sf.Val(New) > 360 Then numTxt.Text=""
End Sub
Logs
java.lang.StackOverflowError
at android.text.SpanSet.init(SpanSet.java:46)
at android.text.TextLine.set(TextLine.java:216)
at android.text.Layout.getHorizontal(Layout.java:854)
at android.text.Layout.getHorizontal(Layout.java:833)
at android.text.Layout.getPrimaryHorizontal(Layout.java:808)
at android.text.Layout.getPrimaryHorizontal(Layout.java:798)
at android.widget.TextView.getFocusedRect(TextView.java:6329)
at android.view.FocusFinder.findNextFocus(FocusFinder.java:120)
at android.view.FocusFinder.findNextFocus(FocusFinder.java:94)
at android.view.FocusFinder.findNextFocus(FocusFinder.java:65)
at android.view.ViewGroup.focusSearch(ViewGroup.java:691)
at android.view.ViewGroup.focusSearch(ViewGroup.java:693)
at android.view.ViewGroup.focusSearch(ViewGroup.java:693)
at android.view.ViewGroup.focusSearch(ViewGroup.java:693)
at android.view.ViewGroup.focusSearch(ViewGroup.java:693)
at android.view.View.focusSearch(View.java:6851)
at android.widget.TextView.onCreateInputConnection(TextView.java:6936)
at android.view.inputmethod.InputMethodManager.startInputInner(InputMethodManager.java:1233)
at android.view.inputmethod.InputMethodManager.restartInput(InputMethodManager.java:1183)
at android.widget.TextView.setText(TextView.java:4655)
at android.widget.TextView.setText(TextView.java:4572)
at android.widget.EditText.setText(EditText.java:109)
at android.widget.TextView.setText(TextView.java:4547)
at anywheresoftware.b4a.objects.TextViewWrapper.setText(TextViewWrapper.java:39)
at anywheresoftware.b4a.objects.EditTextWrapper.setText(EditTextWrapper.java:213)
at b4a.example.main._numtxt_textchanged(main.java:654)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:173)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:161)
at anywheresoftware.b4a.objects.EditTextWrapper$1.afterTextChanged(EditTextWrapper.java:83)
at android.widget.TextView.sendAfterTextChanged(TextView.java:8740)
at android.widget.TextView.setText(TextView.java:4744)
at android.widget.TextView.setText(TextView.java:4572)
at android.widget.EditText.setText(EditText.java:109)
at android.widget.TextView.setText(TextView.java:4547)
at anywheresoftware.b4a.objects.TextViewWrapper.setText(TextViewWrapper.java:39)
at anywheresoftware.b4a.objects.EditTextWrapper.setText(EditTextWrapper.java:213)
at b4a.example.main._numtxt_textchanged(main.java:654)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:173)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:161)
at anywheresoftware.b4a.objects.EditTextWrapper$1.afterTextChanged(EditTextWrapper.java:83)
at android.widget.TextView.sendAfterTextChanged(TextView.java:8740)
at android.widget.TextView.setText(TextView.java:4744)
at android.widget.TextView.setText(TextView.java:4572)
at android.widget.EditText.setText(EditText.java:109)
at android.widget.TextView.setText(TextView.java:4547)
at anywheresoftware.b4a.objects.TextViewWrapper.setText(TextViewWrapper.java:39)
at anywheresoftware.b4a.objects.EditTextWrapper.setText(EditTextWrapper.java:213)
at b4a.example.main._numtxt_textchanged(main.java:654)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:173)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:161)
at anywheresoftware.b4a.objects.EditTextWrapper$1.afterTextChanged(EditTextWrapper.java:83)
at android.widget.TextView.sendAfterTextChanged(TextView.java:8740)
at android.widget.TextView.setText(TextView.java:4744)
at android.widget.TextView.setText(TextView.java:4572)
at android.widget.EditText.setText(EditText.java:109)
at android.widget.TextView.setText(TextView.java:4547)
at anywheresoftware.b4a.objects.TextViewWrapper.setText(TextViewWrapper.java:39)
at anywheresoftware.b4a.objects.EditTextWrapper.setText(EditTextWrapper.java:213)