S shashkiranr Active Member Licensed User Longtime User Jan 11, 2016 #1 Hi All, Need to clear edittext without firing textchanged method. I wanted use Code: Copy editText.getText().clear(); . Is there a way to achieve this using javaobject or reflection method ? Best, SK
Hi All, Need to clear edittext without firing textchanged method. I wanted use Code: Copy editText.getText().clear(); . Is there a way to achieve this using javaobject or reflection method ? Best, SK
M Mahares Expert Licensed User Longtime User Jan 11, 2016 #2 I do not want to sound naive or simplistic, but why not do this: editText.Text ="" Upvote 0
S shashkiranr Active Member Licensed User Longtime User Jan 11, 2016 #3 Hi Mahares, It triggers the textchange method. Best, SK Upvote 0
stevel05 Expert Licensed User Longtime User Jan 11, 2016 #4 Try this: Code: Copy Dim ETJO As JavaObject = EditText1 ETJO.RunMethodJO("getText",Null).RunMethod("clear",Null) It clears the text, but still fires the textchanged method. You'll probably need to use a Global variable flag, and check it and exit the textchanged event if it's set(and unset it), then set the flag when you amend the text but don't want to process the code in the textchanged event. Upvote 0
Try this: Code: Copy Dim ETJO As JavaObject = EditText1 ETJO.RunMethodJO("getText",Null).RunMethod("clear",Null) It clears the text, but still fires the textchanged method. You'll probably need to use a Global variable flag, and check it and exit the textchanged event if it's set(and unset it), then set the flag when you amend the text but don't want to process the code in the textchanged event.
Erel B4X founder Staff member Licensed User Longtime User Jan 12, 2016 #5 Code: Copy editText.Text = "" Sub editText_TextChanged(Old As String, New As String) If New = "" Then Return ... Upvote 0
Code: Copy editText.Text = "" Sub editText_TextChanged(Old As String, New As String) If New = "" Then Return ...