Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to attach event to EditText in DialogFragment using view from xml resourcefile
    primarykey
    data
    text
    <p>I have a class that extends DialogFragment and I set the view from xml source using </p> <pre><code>LayoutInflater inflater = getActivity().getLayoutInflater(); //Inflate and set the layout for the dialog builder.setView(inflater.inflate(R.layout.fragment_password_protection, null)) </code></pre> <p>In that xml file I have one textfield that I want to access and check its values before I click positive button on the DialogFragment, so I override onStart(), get the positive button there and set click (to avoid dismissing Dialog on click). I get the layout using </p> <pre><code>LayoutInflater inflater = getActivity().getLayoutInflater(); View fragmentView = inflater.inflate(R.layout.fragment_password_protection, null); final EditText mPassword = (EditText) fragmentView.findViewById(R.id.password); </code></pre> <p>No I attach textChanged event like this </p> <pre><code>mPassword.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { //DO SOMETHING } @Override public void beforeTextChanged(CharSequence s, int start, int count,int after) { } @Override public void afterTextChanged(Editable s) { } }); </code></pre> <p>but the event is never fired. Do u have any idea how to do this in a proper way? This guy here had the same problem <a href="https://stackoverflow.com/questions/14520899/how-to-retrieve-edittext1-in-dialogfragment-using-view-from-xml-resourcefile">How to retrieve editText1 in DialogFragment using view from xml-resourcefile</a>. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload