Y yes Member Licensed User Oct 12, 2017 #1 i want to reset variable from different modules. lets say variable a is initially has 0 and then i set it to 5. after some activity i want to reset its value. can i use a.length / javaobject/reflector? and how do i write it? i got this error when i tried to write a.length = 0 B4A line: 43 edtText1.Text.Length = 0 javac 1.8.0_131 shell\src\KCSoft\TwoLayouts\main_subs_0.java:73: error: unexpected type main.mostCurrent._edttext1.runMethod(true,"getText").runMethod(true,"length") = BA.numberCast(int.class, 0); Last edited: Oct 12, 2017
i want to reset variable from different modules. lets say variable a is initially has 0 and then i set it to 5. after some activity i want to reset its value. can i use a.length / javaobject/reflector? and how do i write it? i got this error when i tried to write a.length = 0 B4A line: 43 edtText1.Text.Length = 0 javac 1.8.0_131 shell\src\KCSoft\TwoLayouts\main_subs_0.java:73: error: unexpected type main.mostCurrent._edttext1.runMethod(true,"getText").runMethod(true,"length") = BA.numberCast(int.class, 0);
Alexander Stolte Expert Licensed User Longtime User Oct 12, 2017 #2 You can Handle it with a LegthFilter on your EdditText. Code: Sub Globals Dim IME As IME Dim edtTest As EditText End Sub Sub Activity_Create(FirstTime As Boolean)Activity.LoadLayout("layout1") edtTest.Color=Colors.Red IME.Initialize("IME") IME.SetLengthFilter(edtTest, 20) End Sub Upvote 0
You can Handle it with a LegthFilter on your EdditText. Code: Sub Globals Dim IME As IME Dim edtTest As EditText End Sub Sub Activity_Create(FirstTime As Boolean)Activity.LoadLayout("layout1") edtTest.Color=Colors.Red IME.Initialize("IME") IME.SetLengthFilter(edtTest, 20) End Sub
Y yes Member Licensed User Oct 12, 2017 #3 Alexander Stolte said: You can Handle it with a LegthFilter on your EdditText. Code: Sub Globals Dim IME As IME Dim edtTest As EditText End Sub Sub Activity_Create(FirstTime As Boolean)Activity.LoadLayout("layout1") edtTest.Color=Colors.Red IME.Initialize("IME") IME.SetLengthFilter(edtTest, 20) End Sub Click to expand... thank you sir. i understand this code only apply for edit text. so can this library filter length for string? .if possible for all variable types Upvote 0
Alexander Stolte said: You can Handle it with a LegthFilter on your EdditText. Code: Sub Globals Dim IME As IME Dim edtTest As EditText End Sub Sub Activity_Create(FirstTime As Boolean)Activity.LoadLayout("layout1") edtTest.Color=Colors.Red IME.Initialize("IME") IME.SetLengthFilter(edtTest, 20) End Sub Click to expand... thank you sir. i understand this code only apply for edit text. so can this library filter length for string? .if possible for all variable types
Alexander Stolte Expert Licensed User Longtime User Oct 12, 2017 #4 how do you fill the string with data? Upvote 0
Y yes Member Licensed User Oct 12, 2017 #5 please correct me. i simply set b as string = "something" Upvote 0
Alexander Stolte Expert Licensed User Longtime User Oct 12, 2017 #6 I do not know a method to add a string, a maximum value. The only thing you can do is to check the length and if it exceeds the maximum value, then give an error message or set the value to empty "". Or you check the length and you simply remove the superfluous character. Upvote 0
I do not know a method to add a string, a maximum value. The only thing you can do is to check the length and if it exceeds the maximum value, then give an error message or set the value to empty "". Or you check the length and you simply remove the superfluous character.
klaus Expert Licensed User Longtime User Oct 12, 2017 #7 I don't understand what exactly you want to do with edtText1.Text.Length = 0 ? Set it simply to edtText1.Text = "" And edtText1.Text.Length will be 0. Upvote 0
I don't understand what exactly you want to do with edtText1.Text.Length = 0 ? Set it simply to edtText1.Text = "" And edtText1.Text.Length will be 0.
Y yes Member Licensed User Oct 12, 2017 #8 klaus said: I don't understand what exactly you want to do with edtText1.Text.Length = 0 ? Set it simply to edtText1.Text = "" And edtText1.Text.Length will be 0. Click to expand... thanks but i wonder if i can clear variable with javaobject / refelector? Upvote 0
klaus said: I don't understand what exactly you want to do with edtText1.Text.Length = 0 ? Set it simply to edtText1.Text = "" And edtText1.Text.Length will be 0. Click to expand... thanks but i wonder if i can clear variable with javaobject / refelector?
Computersmith64 Well-Known Member Licensed User Longtime User Oct 12, 2017 #10 If you want to reset a string, just set it to "" & then you can check for that value: Code: Private thisString as String = "A String" ... thisString = "" .... If thisString = "" Then Log("thisString is empty!") End If - Colin. Upvote 0
If you want to reset a string, just set it to "" & then you can check for that value: Code: Private thisString as String = "A String" ... thisString = "" .... If thisString = "" Then Log("thisString is empty!") End If - Colin.