0
Good afternoon!
I’m starting my studies in Java and I’ve come to this topic. What I call the method insert
on the side of Activity
, past the field EditText
defendant?
public static TextWatcher insert(final EditText editText){
return new TextWatcher() {
...
public void onTextChanged(CharSequence cs, int start, int before, int count){
editText.setText("Qualquer coisa");
Post the complete code because this logic is very confusing. How are you setting value to Edittext during the onTextChanged event? See the loop: the changed text calls the event, the event changes the text... This will not work.
– Reginaldo Rigo
So Reginaldo, I took the code you posted here with that Dynamic Mask for Cpf;cnpf and I’m slowly unlocking it to understand it: On the Activity side you have the fields below: report=(Textview)findViewById(R.id.txtReport); password=(Edittext)findViewById(R.id.edtPassword); I just want to change the Edittext(password) field for example, the Label(report) field receives a Text or the Edittext field itself changes, just to know that it’s working, I don’t know how to call it from the Activity side.
– Fabiano Jose
After initializing the object like this: report=(Textview)findViewById(R.id.txtReport); you can assign text to it like this: report.setText("Test");
– Reginaldo Rigo
Yes yes, I’m trying to call an external class , inside a package that returns a Textwatcher , how to call it inside my Activity?
– Fabiano Jose